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

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...