Sunday, 19 December 2021

Build release version of cordova app and sign your apk

https://medium.com/beingcoders/create-a-signed-apk-file-using-cordova-cli-49ffbe423cee

https://www.youtube.com/watch?v=aHTfXivFe74  

https://stackoverflow.com/questions/35173542/unable-to-sign-the-unsigned-apk/35173700



Monday, 29 November 2021

Convert Website To Android App Using Apache Cordova

https://youtu.be/9OnZuuJJlCk

1. cordova zomok com.zomok.app // create dir

2. cordova platform add android

3. cordova requirements


4. Install necessary plug-ins

 


5.Bulid android



6


Friday, 13 August 2021

JavaScript四舍五入并保留两位小数

在JavaScript中,有一个问题一直被没有很好地解决,就是小数点保留指定的位数,也就是我们通常说的Math.Round()函数。

首先,JavaScript有自带的Math.Round()函数,能够对一个浮点数进行四舍五入,但是返回的结果是个整数,无法精确到小数点后。

Number.toFixed()方法,能保留小数点后面的指定位数,但如果执行2.1.toFixed(2)的话,会返回2.10,而不是我们期待的2.1,所以,这个方法也不太可取。

最近我发现一个很简单的方法,假设我要对0.105进行四舍五入并保留两位小数,如果直接调用Math.Round()的话,结果是0,如果直接调用.toFixed(2)方法的话,会返回0.10,最简单有效的方法就是对0.105先乘以100,再调用Math.Round(),然后再除以100,就OK了。 

var number = 0.105;
alert(Math.round(number * 100) / 100);

网页弹出0.11

举一反三,如果你想保留三位小数,就是

Math.round(number * 1000) / 1000

如果你想转换为百分比,再保留两位小数,就是

(Math.round(number * 10000) / 100) + '%'
 


————————————————
版权声明:本文为CSDN博主「老朱.」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/daguanjia11/article/details/48650711

Friday, 6 August 2021

Row count with PDO

$sql = "SELECT count(*) FROM `table` WHERE foo = ?"; 
$result = $con->prepare($sql); 
$result->execute([$bar]); 
$number_of_rows = $result->fetchColumn(); 

Friday, 4 June 2021

PHP - FREE CODE ENCRYPTION | ALTERNATIVE OF ZEND | EASY| ENCODING | PROTECTED PHP CODE | TUTORIAL

 

 

Yes, you can definitely hide/encode/encrypt the php source code and 'others' can install it on their machine. You could use the below tools to achieve the same.

But these 'others' can also decode/decrypt the source code using other tools and services found online. So you cannot 100% protect your code, what you can do is, make it tougher for someone to reverse engineer your code.

Most of these tools above support Encoding and Obfuscating.

  • Encoding will hide your code by encrypting it.
  • Obfuscating will make your code difficult to understand.

You can choose to use both (Encoding and Obfuscating) or either one, depending on your needs.

Saturday, 22 May 2021

https://stackoverflow.com/questions/4439320/how-do-i-protect-phone-number-from-bots

 

This is a...passing thought, though I'm not sure how practical it would be:

<span class="protectedNumber" title="01234567890"></span>

css:

span.protectedNumber:before {
    content: "Phone number: " attr(title);
}

Saturday, 8 May 2021

show dot in span

 https://stackoverflow.com/questions/11426275/how-can-i-show-dots-in-a-span-with-hidden-overflow

Friday, 23 April 2021

https://www.youtube.com/watch?v=9yUF9yz02Cc

 https://www.youtube.com/watch?v=9yUF9yz02Cc

Developer Skill Sprint - App to Store: Build and Publish to iOS App Store and Google Play

 

Thursday, 22 April 2021

Utilizing the HTML5 File API to choose, upload, preview and see progress for multiple files

 

Utilizing the HTML5 File API to choose, upload, preview and see progress for multiple files

https://robertnyman.com/2010/12/16/utilizing-the-html5-file-api-to-choose-upload-preview-and-see-progress-for-multiple-files/

Friday, 16 April 2021

Saturday, 3 April 2021

Tuesday, 30 March 2021

Deploying Android App (developed in Delphi FireMonkey) to Google Play Store

 https://stackoverflow.com/questions/29123404/deploying-android-app-developed-in-delphi-firemonkey-to-google-play-store/29130191

 


 

 

 

Monday, 22 March 2021

duriNews is a news aggregator that constantly up to dates and organizes the news and current events.

duriNews is a news aggregator that constantly updates and organizes the news and current events that are happening locally and internationally.
 

Top 5 Reasons to Download the duriNews App
1. Watch news and video of your favorite anytime, anywhere.
2. 24/7 with local and international news.
3. Introduction to the user interface.
4. News stories that matter most to you, with relevant, formatted content.
5. Easy to find and follow the sources you trust, as well as browse and discover new ones.

There are different languages to choose from, including Malaysian Chinese, Malay, Thai Chinese, Indonesian and Filipino.

In addition to different languages, we also provide different categories, such as international news, local news, sports, entertainment, politics, business economics and videos.

You are also welcome to visit our official website https://www.durinews.com. Or visit https://www.durinews.com/download/ to download the latest version.

We strive to do better. Thank you.

Thursday, 11 March 2021

target="_blank

 

if WebBrowser1.LocationURL = 'about:blank' then
  ShowMessage('about:blank page is displayed ...');

Wednesday, 10 March 2021

record(str);

        function record(str){
        var p = document.createElement("p");
        p.appendChild(document.createTextNode(str));
        document.body.appendChild(p);

Monday, 8 March 2021

https://img.youtube.com/vi/DjB1OvEYMhY/hqdefault.jpg

 https://img.youtube.com/vi/DjB1OvEYMhY/hqdefault.jpg

iframe Onclick

 <html>
<head>
<script type="text/javascript">
window.onload = function() {
    var oFrame = document.getElementById("myFrame");
    oFrame.contentWindow.document.onclick = function() {
        alert("frame contents clicked");
    };
};
</script>
</head>
<body>
    
    
<iframe id="myFrame" border="0" src="test.htm"></iframe>
<iframe id="theiframe" src="test.htm" style="width: 200px; height: 400px;" onload="iframeclick()"></iframe>
</body></html>



HTML DOM activeElement Property

 <!DOCTYPE html>
<html>
<body onclick="myFunction()">

<p>Click anywhere in the document to display the active element.</p>
<input type="text" value="An input field">
<button>A Button</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.activeElement.tagName;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Friday, 26 February 2021

Delphi XE5 获取Android手机网络状态

 https://blog.csdn.net/weixin_30607659/article/details/95270618

介绍

本文章介绍了Delphi XE5 获取Android手机网络状态,通过该代码可以得到Wift是否连接、手机网络是否连接,首先会实现一个类库Androidapi.JNI.Network,然后通过这类库来判断网络状况。


在使用这个类库之前,需要配置手机的权限,否则无法得到信息。

下面是这个判断类库的代码:

unit Androidapi.JNI.Network;

interface

function IsConnected: Boolean;

function IsWiFiConnected: Boolean;

function IsMobileConnected: Boolean;

implementation

uses
System.SysUtils,
Androidapi.JNIBridge,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.JavaTypes,
FMX.Helpers.Android;

type
JConnectivityManager = interface;
JNetworkInfo = interface;

JNetworkInfoClass = interface(JObjectClass)
['{E92E86E8-0BDE-4D5F-B44E-3148BD63A14C}']
end;

[JavaSignature('android/net/NetworkInfo')]
JNetworkInfo = interface(JObject)
['{6DF61A40-8D17-4E51-8EF2-32CDC81AC372}']
{Methods}
function isAvailable: Boolean; cdecl;
function isConnected: Boolean; cdecl;
function isConnectedOrConnecting: Boolean; cdecl;
end;
TJNetworkInfo = class(TJavaGenericImport<JNetworkInfoClass, JNetworkInfo>) end;

JConnectivityManagerClass = interface(JObjectClass)
['{E03A261F-59A4-4236-8CDF-0068FC6C5FA1}']
{Property methods}
function _GetTYPE_WIFI: Integer; cdecl;
function _GetTYPE_WIMAX: Integer; cdecl;
function _GetTYPE_MOBILE: Integer; cdecl;
{Properties}
property TYPE_WIFI: Integer read _GetTYPE_WIFI;
property TYPE_WIMAX: Integer read _GetTYPE_WIMAX;
property TYPE_MOBILE: Integer read _GetTYPE_MOBILE;
end;

[JavaSignature('android/net/ConnectivityManager')]
JConnectivityManager = interface(JObject)
['{1C4C1873-65AE-4722-8EEF-36BBF423C9C5}']
{Methods}
function getActiveNetworkInfo: JNetworkInfo; cdecl;
function getNetworkInfo(networkType: Integer): JNetworkInfo; cdecl;
end;
TJConnectivityManager = class(TJavaGenericImport<JConnectivityManagerClass, JConnectivityManager>) end;

function GetConnectivityManager: JConnectivityManager;
var
ConnectivityServiceNative: JObject;
begin
ConnectivityServiceNative := SharedActivityContext.getSystemService(TJContext.JavaClass.CONNECTIVITY_SERVICE);
if not Assigned(ConnectivityServiceNative) then
raise Exception.Create('Could not locate Connectivity Service');
Result := TJConnectivityManager.Wrap(
(ConnectivityServiceNative as ILocalObject).GetObjectID);
if not Assigned(Result) then
raise Exception.Create('Could not access Connectivity Manager');
end;

function IsConnected: Boolean;
var
ConnectivityManager: JConnectivityManager;
ActiveNetwork: JNetworkInfo;
begin
ConnectivityManager := GetConnectivityManager;
ActiveNetwork := ConnectivityManager.getActiveNetworkInfo;
Result := Assigned(ActiveNetwork) and ActiveNetwork.isConnected;
end;

function IsWiFiConnected: Boolean;
var
ConnectivityManager: JConnectivityManager;
WiFiNetwork: JNetworkInfo;
begin
ConnectivityManager := GetConnectivityManager;
WiFiNetwork := ConnectivityManager.getNetworkInfo(TJConnectivityManager.JavaClass.TYPE_WIFI);
Result := WiFiNetwork.isConnected;
end;

function IsMobileConnected: Boolean;
var
ConnectivityManager: JConnectivityManager;
MobileNetwork: JNetworkInfo;
begin
ConnectivityManager := GetConnectivityManager;
MobileNetwork := ConnectivityManager.getNetworkInfo(TJConnectivityManager.JavaClass.TYPE_MOBILE);
Result := MobileNetwork.isConnected;
end;

end.

 

通过这个类库,我们可以调用IsConnected、IsWiFiConnected、IsMobileConnected函数来判断网络状况

function GetNetworkState: string; // 得到当前网络连接状态
var
 NS: TNetworkState;
begin
 NS := TNetworkState.Create;
 try
  if not NS.IsConnected then // 无网络
   result := '0'
  else if NS.IsWifiConnected then // wifi
   result := '1'
  else if NS.IsMobileConnected then // 移动数据
   result := '2';
 finally
   NS.Free;
 end;
end;

 

 

查看原文

Delphi XE5 获取Android手机网络状态
http://www.dfwlt.com/forum.php?mod=viewthread&tid=826
(出处: 大富翁Delphi开发技术网站)

转载于:https://www.cnblogs.com/wcf-delphi/p/8616106.html

 

 

Wednesday, 17 February 2021

Calculate the number of days between two dates in PHP

 

<?php
function dateDifference($start_date, $end_date)
{
    // calulating the difference in timestamps
    $diff = strtotime($start_date) - strtotime($end_date);
    
    // 1 day = 24 hours
    // 24 * 60 * 60 = 86400 seconds
    return ceil(abs($diff / 86400));
}
// start date
$start_date = "2016-01-02";
// end date
$end_date = "2016-01-21";
// call dateDifference() function to find the number of days between two dates
$dateDiff = dateDifference($start_date, $end_date);
echo "Difference between two dates: " . $dateDiff . " Days ";
?>

Monday, 8 February 2021

Python: Find urls in a string

 

import re
text = '<p>Contents :</p><a href="https://w3resource.com">Python Examples</a><a href="http://github.com">Even More Examples</a>'
urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', text)
print("Original string: ",text)
print("Urls: ",urls)

Python XML Jumpstart in only 5 minutes

 


Friday, 29 January 2021

Connected?

try
IdHTTP1.Get(URL);
c := IdHTTP1.ResponseCode;

if c = 200 then
begin
lblbottom.Visible:= false;
timer1.Interval := 0;
webbrowser1.GoBack;
end;
except

end;

Wednesday, 27 January 2021

Program DateDemo

 Program DateDemo;
uses sysutils;
var
YY,MM,DD : Word;

begin
writeln ('Date : ',Date);
DeCodeDate (Date,YY,MM,DD);
writeln (format ('Today is (DD/MM/YY): %d/%d/%d ',[dd,mm,yy]));
end.

Sunday, 24 January 2021

Detect internet access in Delphi

 

uses IdTCPClient;

function CheckInternet : Boolean;

var TCPClient : TIdTCPClient;

begin
  TCPClient := TIdTCPClient.Create (NIL);

  try
    try
      TCPClient.ReadTimeout := 2000;
      TCPClient.ConnectTimeout := 2000;
      TCPClient.Port := 80;
      TCPClient.Host := 'google.com';
      TCPClient.Connect;
      TCPClient.Disconnect;
      Result := true;

      except
        Result := false;
      end; { try / except }

    finally
      TCPClient.Free;
    end; { try / finally }
end;

Wednesday, 20 January 2021

How can I change name of FireMonkey Mobile application to contain spaces?

 https://community.embarcadero.com/article/technical-articles/145-ui/973-how-can-i-change-name-of-firemonkey-mobile-application-to-contain-spaces

Saturday, 16 January 2021

delphi 判断前网络连接状态

 

unit Androidapi.JNI.Network;

interface

function IsConnected: Boolean;

function IsWiFiConnected: Boolean;

function IsMobileConnected: Boolean;

implementation

uses
System.SysUtils,
Androidapi.JNIBridge,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.JavaTypes,
FMX.Helpers.Android;

type
JConnectivityManager = interface;
JNetworkInfo = interface;

JNetworkInfoClass = interface(JObjectClass)
['{E92E86E8-0BDE-4D5F-B44E-3148BD63A14C}']
end;

[JavaSignature('android/net/NetworkInfo')]
JNetworkInfo = interface(JObject)
['{6DF61A40-8D17-4E51-8EF2-32CDC81AC372}']
{Methods}
function isAvailable: Boolean; cdecl;
function isConnected: Boolean; cdecl;
function isConnectedOrConnecting: Boolean; cdecl;
end;
TJNetworkInfo = class(TJavaGenericImport<JNetworkInfoClass, JNetworkInfo>) end;

JConnectivityManagerClass = interface(JObjectClass)
['{E03A261F-59A4-4236-8CDF-0068FC6C5FA1}']
{Property methods}
function _GetTYPE_WIFI: Integer; cdecl;
function _GetTYPE_WIMAX: Integer; cdecl;
function _GetTYPE_MOBILE: Integer; cdecl;
{Properties}
property TYPE_WIFI: Integer read _GetTYPE_WIFI;
property TYPE_WIMAX: Integer read _GetTYPE_WIMAX;
property TYPE_MOBILE: Integer read _GetTYPE_MOBILE;
end;

[JavaSignature('android/net/ConnectivityManager')]
JConnectivityManager = interface(JObject)
['{1C4C1873-65AE-4722-8EEF-36BBF423C9C5}']
{Methods}
function getActiveNetworkInfo: JNetworkInfo; cdecl;
function getNetworkInfo(networkType: Integer): JNetworkInfo; cdecl;
end;
TJConnectivityManager = class(TJavaGenericImport<JConnectivityManagerClass, JConnectivityManager>) end;

function GetConnectivityManager: JConnectivityManager;
var
ConnectivityServiceNative: JObject;
begin
ConnectivityServiceNative := SharedActivityContext.getSystemService(TJContext.JavaClass.CONNECTIVITY_SERVICE);
if not Assigned(ConnectivityServiceNative) then
raise Exception.Create('Could not locate Connectivity Service');
Result := TJConnectivityManager.Wrap(
(ConnectivityServiceNative as ILocalObject).GetObjectID);
if not Assigned(Result) then
raise Exception.Create('Could not access Connectivity Manager');
end;

function IsConnected: Boolean;
var
ConnectivityManager: JConnectivityManager;
ActiveNetwork: JNetworkInfo;
begin
ConnectivityManager := GetConnectivityManager;
ActiveNetwork := ConnectivityManager.getActiveNetworkInfo;
Result := Assigned(ActiveNetwork) and ActiveNetwork.isConnected;
end;

function IsWiFiConnected: Boolean;
var
ConnectivityManager: JConnectivityManager;
WiFiNetwork: JNetworkInfo;
begin
ConnectivityManager := GetConnectivityManager;
WiFiNetwork := ConnectivityManager.getNetworkInfo(TJConnectivityManager.JavaClass.TYPE_WIFI);
Result := WiFiNetwork.isConnected;
end;

function IsMobileConnected: Boolean;
var
ConnectivityManager: JConnectivityManager;
MobileNetwork: JNetworkInfo;
begin
ConnectivityManager := GetConnectivityManager;
MobileNetwork := ConnectivityManager.getNetworkInfo(TJConnectivityManager.JavaClass.TYPE_MOBILE);
Result := MobileNetwork.isConnected;
end;

end.

 

通过这个类库,我们可以调用IsConnected、IsWiFiConnected、IsMobileConnected函数来判断网络状况

function GetNetworkState: string; // 得到当前网络连接状态
var
 NS: TNetworkState;
begin
 NS := TNetworkState.Create;
 try
  if not NS.IsConnected then // 无网络
   result := '0'
  else if NS.IsWifiConnected then // wifi
   result := '1'
  else if NS.IsMobileConnected then // 移动数据
   result := '2';
 finally
   NS.Free;
 end;
end;

 

 

查看原文

Delphi XE5 获取Android手机网络状态
http://www.dfwlt.com/forum.php?mod=viewthread&tid=826
(出处: 大富翁Delphi开发技术网站)

转载于:https://www.cnblogs.com/wcf-delphi/p/8616106.html

 

 

https://delphiworlds.com/download/network-state-demo/

https://www.amingstudio.com/delphi/598.html

Friday, 15 January 2021

How to check if network is available on Android and iOS ( Delphi XE5 )

 https://stackoverflow.com/questions/18888345/how-to-check-if-network-is-available-on-android-and-ios-delphi-xe5

Saturday, 2 January 2021

Load Picture from URL

 

uses
  GIFImg;

procedure TForm1.btn1Click(Sender: TObject);
var
  MS : TMemoryStream;
  GIf: TGIFImage;
begin
  MS := TMemoryStream.Create;
  GIf := TGIFImage.Create;
  try
    IdHTTP1.get('http://www.google.com/intl/en_ALL/images/logo.gif',MS);
    Ms.Seek(0,soFromBeginning);       
    Gif.LoadFromStream(MS);
    img1.Picture.Assign(GIF);

  finally
    FreeAndNil(GIF);
    FreeAndNil(MS);
  end;
end;

zomok E-commerce system plan. Choose your online ordering system. No-risk 30 day free trial. Then USD 9/month. No credit card required.

zomok E-commerce system plan. Choose your online ordering system. No-risk 30 day free trial. Then USD 9/month. No credit card required. h...