我想从第二个PHP文件中调用一个PHP文件中的函数,并将两个参数传递给该函数.我怎样才能做到这一点?
我是PHP的新手.所以请告诉我,我应该将第一个PHP文件包含在第二个中吗?
请给我举个例子.如果需要,您可以提供一些链接.
在MySQL中,此查询可能会抛出除以零的错误:
SELECT ROUND(noOfBoys / noOfGirls) AS ration
FROM student;
Run Code Online (Sandbox Code Playgroud)
如果noOfGirls
是0
则则计算失败.
处理这个问题的最佳方法是什么?
我想有条件改变的值noOfGirls
来1
时,它等于0
.
有没有更好的办法?
这是我的第一个HTML页面:
<!--first.html-->
<html>
<body>
<div data-role="page" data-theme="a" data-url="first" id="first">
<form id="form1" name="form2" action="checking.html">
<input type="text" name="txtFileName" id="txtFileName"/>
<!-- <button onClick="uploadFile();">Upload</button> -->
<input type="hidden" name="hidden1" value="">
<br><input type="submit" value="Send me your name!" onClick="submitform();"><br>
</form>
<script type="text/javascript">
function submitform()
{
document.forms.form1.hidden1.value=1;
alert("i am working");
document.form1.submit();
}
</script>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是我的第二个HTML页面:
<!-- second.html -->
<html>
<head>
</head>
<body>
<h1>Javascript call after page loaded</h1>
<script>
function getQueryVariable2(variable) {
var query = window.location.search.substring(1);
document.write(query);
var vars = query.split("&");
document.write("<br />");
document.write(vars);
for (var i=0;i<vars.length;i++) …
Run Code Online (Sandbox Code Playgroud) 我在Android工作.我需要以全屏模式显示我的活动,我使用以下代码完成此操作.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Run Code Online (Sandbox Code Playgroud)
现在它看起来像这样: -
现在我想退出这个完整模式,所以我的活动应该像以前一样显示.像这样:-
我有一个按钮,用于在完全模式或正常模式之间切换,我将一次又一次地切换模式.请建议我怎么做这个.意味着如何从全屏获得正常的屏幕.
先感谢您.
我在Android工作.我想做一个SeekBar
.SeekBar
我想要显示进度的拇指(可能是TextView
拇指上移动的拇指对齐).
这是我的XML的SeekBar
和TextView
.
<SeekBar
android:id="@+id/ProgressBar01"
android:layout_width="fill_parent"
android:paddingLeft="10px"
android:paddingRight ="10px"
android:layout_height="70dp"
android:layout_below="@+id/incentives_textViewBottemLeft"
android:max="10"
android:progressDrawable="@drawable/incentive_progress"
android:secondaryProgress="0"
android:thumb="@drawable/incentives_progress_pin"
android:focusable="false" />
<TextView
android:id="@+id/incentives_textViewAbove_process_pin"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:layout_below="@+id/incentives_textViewBottemLeft"
android:layout_marginTop="11dp"
android:text=""
android:textStyle="bold"
android:textColor="#FFe4e1"
android:textSize="15sp" />
Run Code Online (Sandbox Code Playgroud)
这是我的代码,使文本对齐
int xPos = ((mSkbSample.getRight() - mSkbSample.getLeft()) / mSkbSample.getMax()) * mSkbSample.getProgress();
v1.setPadding(xPos+m,0,0,0);
v1.setText(String.valueOf(progress).toCharArray(), 0, String.valueOf(progress).length());
Run Code Online (Sandbox Code Playgroud)
但是文字没有显示在那个拇指的中心.请建议我该怎么做.
我认为java是纯面向对象的,但实际上并非如此.但我不知道为什么java不是纯粹的面向对象语言,请帮我找出原因.
我在android工作.我想在我的代码中创建共享首选项,但我不知道我可以为数组创建共享首选项的方式以及如何在另一个类中使用该共享首选项的值.
这是我的一个for循环数组: - urls [i] = sitesList.getWebsite().get(i);
我想做这个urls []数组的共享偏好.请建议我如何编写代码来声明共享首选项以及如何检索该共享首选项的值?
先感谢您.
我正在研究MVC asp.net.
这是我的控制器动作:
public ActionResult ingredientEdit(int id) {
ProductFormulation productFormulation = db.ProductFormulation.Single(m => m.ID == id);
return View(productFormulation);
}
//
// POST: /Admin/Edit/5
[HttpPost]
public ActionResult ingredientEdit(ProductFormulation productFormulation) {
productFormulation.CreatedBy = "Admin";
productFormulation.CreatedOn = DateTime.Now;
productFormulation.ModifiedBy = "Admin";
productFormulation.ModifiedOn = DateTime.Now;
productFormulation.IsDeleted = false;
productFormulation.UserIP = Request.ServerVariables["REMOTE_ADDR"];
if (ModelState.IsValid) {
db.ProductFormulation.Attach(productFormulation);
db.ObjectStateManager.ChangeObjectState(productFormulation, EntityState.Modified);
db.SaveChanges();
**return RedirectToAction("ingredientIndex");**
}
return View(productFormulation);
}
Run Code Online (Sandbox Code Playgroud)
我想将id传递给ingredientIndex
action.我怎样才能做到这一点?
我想使用这个来自另一个页面的id 公共ActionResult ingredientEdit(int id).实际上我没有id
第二个动作,请建议我该怎么做.
可能重复:
使用HttpRequest.execute()的异常:无效使用SingleClientConnManager:仍然分配连接
我在Android工作.我创建了HttpSingleton类来在我的完整应用程序中创建HttpClient的单个intance.
这是我使用这个类的代码: -
HttpGet get = new HttpGet("url/dologin/savitagupta/savitagupta");
**HttpResponse rp = HttpSigleton.getInstance().execute(get);**
if (rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
// some code here
}
Run Code Online (Sandbox Code Playgroud)
这是我的单例实例
public class HttpSigleton {
private static HttpClient instance = null;
protected HttpSigleton() {
}
public static HttpClient getInstance() {
if(instance == null) {
instance =new DefaultHttpClient();
}
return instance;
}
}
Run Code Online (Sandbox Code Playgroud)
然后发生错误是: -
SingleClientConnManager:无效使用SingleClientConnManager:仍然分配了连接.确保在分配另一个连接之前释放连接.请告诉我我做了什么错误.我真的需要你的帮助.先感谢您.
我在J2ME工作.我希望我的应用程序必须在我的设备重新启动时自动启动.
我已经制作了诺基亚-MIDlet-auto-start:是的,我的JAD文件中的条目是建议的
MIDlet目前尚未签名,我正在使用诺基亚手机进行测试(特别是诺基亚S60).无论如何,如上所述,当我重启设备时,应用程序无法自动启动.
请建议我如何在设备启动时自动重启我的MIDLet.谢谢.
android ×5
java ×2
asp.net-mvc ×1
cordova ×1
html ×1
html5 ×1
httpclient ×1
java-me ×1
javascript ×1
layoutparams ×1
midp ×1
mysql ×1
nokia ×1
php ×1
s60 ×1
seekbar ×1
sql ×1
textview ×1
view ×1