草庐IT

calculate_something

全部标签

php - preg_match : ensure the start and the end contains something

我想要一个正则表达式来确保字符串的开头包含“http://”和“/”以及结尾。这是我想出的一个更长的版本,if(!preg_match("/(^http:\/\//",$site_http)){$error=true;echo'';}elseif(!preg_match("/\/$/",$site_http)){$error=true;echo'';}但我认为这两个表达式可以像下面这样放在一起,但它行不通,if(!preg_match("/(^http:\/\/)&(\/$)/",$site_http)){$error=true;echo'';}我尝试组合的多个表达式一定是错误的!有什

php - bigcommerce API更新产品问题 "The field ' calculated_price'无法写入。请在重试之前将其从您的请求中删除”

谁能帮我们解决这个问题....fatalerror:未捕获的客户端错误(400):无法写入字段“calculated_price”。请在重试之前将其从您的请求中删除。$old_product=Bigcommerce_Api::getProduct($bid);$old_product->name=$_POST['part_number'];$old_product->price=$_POST['price'];$old_product->weight=$_POST['weight'];$old_product->width=$_POST['width'];$old_product->c

php - 使用 Apache .htaccess 设置动态 Php $_SERVER 值($_SERVER ['something' ])

这是对thisquestion的扩展我们了解到可以使用SetEnv设置$_SERVER变量。下一个问题是:有没有一种方法可以像这样使用SetEnv:/var/www/www.example.com/module/unique_section/.htaccess:SetEnvRESOURCE_ROOT%{DIRECTORY}/var/www/www.example.com/module/unique_section/some/path/file.php输出:/var/www/www.example.com/module/unique_section/ 最佳答案

android - 无赖 : something went wrong trying to "Ping Bluemix" from helloAuthentication Android sample app

与helponthisforum,我终于能够运行“bms-samples-hellototodo-advanced”,它使用带有Facebook身份验证的MCA。我仍然对“bms-samples-helloauthentication”感到不满意,它使用MCA和Google身份验证。我正在使用Genymotion模拟器使用AndroidStudio进行构建和调试。我正在按照这些说明操作:bms-samples-android-helloauthenticationREADME.mdhttps://console.ng.bluemix.net/docs/services/mobileac

android - Realm Android javassist.NotFoundException : io. realm.com_example_realmtest_data_SomethingRealmProxyInterface

我对android中的Realm完全陌生,我从只有一个只有一个字段的实体的简单kotlin项目开始。openclassSomething:RealmObject(){@PrimaryKeyvarid:Long=0}我在我的应用程序类中初始化了Realm:classRealmApp:Application(){overridefunonCreate(){super.onCreate()Realm.init(this)valconfig=RealmConfiguration.Builder().build()Realm.setDefaultConfiguration(config)}}当然

安卓 : Do something when battery is at a defined level

我在这里遇到了一个小问题。我希望我的应用程序执行某些操作,但仅限于电池电量为10%时。我的应用不会持续监控电池电量;它只是等待LOW_BATTERYIntent。如果我不指定级别它会起作用,但它会起作用3次:15%、10%和5%我只希望它以10%的速度做某事。这是我的代码:publicvoidonReceive(Contextcontext,Intentintent){if(intent.getAction().equals(ACTION_BATTERY_LOW)){intlevel=intent.getIntExtra(BatteryManager.EXTRA_LEVEL,-1);i

java - 检查资源中是否存在 ID (R.id.something)

因此,我有代码使用默认设置为Integer.MAX_VALUE的AtomicInteger为许多元素生成ID,并从那里递减,每个View都分配了一个ID。因此,具有生成ID的第一个View将是Integer.MAX_VALUE-1,第二个将是Integer.MAX_VALUE-2,等等。我担心的问题是与Android在R.java中生成的ID发生冲突。所以我的问题是如何检测ID是否已被使用并在生成ID时跳过它。我最多只生成30个ID,所以这不是一个重要的优先事项,我想让它尽可能没有错误。 最佳答案 以下代码将告诉您标识符是否为id。

android - 布局问题 : how to place something on top and bottom?

我想创建一个布局,顶部和底部有一个水平的LinearLayout(s),一个ListView填充在中间。如何定义main.xml。我尝试创建一个顶部为水平LinearLayout、底部为TextView、中间为ListView的布局;没关系。但是我把最下面的TextView修改成LinearLayout之后,最下面的LinearLayout就消失了。谁能告诉我建议?请帮忙。 最佳答案 尝试将整个集合包含在RelativeLayout中:使用尺寸调整内容进行编辑。 关于android-布局

安卓 : PSS (Proportional Set Size) Calculation

我想弄清楚Android的PSS是如何计算的。我找到一个article说明如下。The"proportionalsetsize"(PSS)ofaprocessisthecountofpagesithasinmemory,whereeachpageisdividedbythenumberofprocessessharingit.Soifaprocesshas1000pagesalltoitself,and1000sharedwithoneotherprocess,itsPSSwillbe1500我的第一个问题是,以上信息准确吗?如果不是,有人能告诉我它是如何计算出来的吗?此外,这个值是千

android - 将 URI 与 <data> 匹配,例如 AndroidManifest 中的 http ://example. com/something

我正在为苦苦挣扎AndroidManifest.xml中的元素文件以使我的URI匹配工作。我想匹配以下URI:http://example.com/somethinghttp://example.com/foohttp://example.com/foo/但不是http://example.comhttp://example.com/http://example.com/something/else我主要是用它来工作但它仍然匹配http://example.com/something/else.我怎样才能排除这些? 最佳答案 不幸的