我正在尝试将一些数据发送到我的网站.单击该按钮时,需要将数据发送到网站
但是当我运行程序时,我遇到了一些错误
当我点击按钮时,此消息显示"不幸的是app已经停止",然后退出我的应用程序.
public class testInput extends Activity {
Button Setbutton;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.test_input_page);
Setbutton=(Button)findViewById(R.id.setbtn);
Setbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
testInput ti=new testInput();
//Create the intent
ti.postData("Sent Data");
});
}
public void postData(String toPost) {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://mysite.com/index.php");
//This is the data to send
String MyName …
Run Code Online (Sandbox Code Playgroud) 我没有oncomplete
在标准JSF中的PrimeFaces中的某些标签中找到可用的属性<h:commandButton>
.
如何在使用时获得类似功能的完整功能<h:commandButton>
?
我正在开发一个Web应用程序,我使用JSF和PrimeFaces框架以及外部Geo Map API.
POI_id
当我点击地图上的POI时,Map API会给我.但这对我来说还不够,我想从servlet获取有关POI的信息并在弹出窗口中显示它.(地址,姓名,电话号码等字段).
因此,当我单击地图上的POI时,我需要向托管bean中的servlet发送HTTP请求.
我可以得到poi_id
,但我不能将此id发送到后端托管bean,因此获取POI信息似乎不可能.
如何发送poi_id
到我的托管bean并处理在弹出窗口中显示的响应?
在我的JSF-PrimeFaces webapp中,我需要将其内容垂直对齐到中心.我怎样才能做到这一点?
<p:panel id="businesses_panel" header="#{business.businessName}" styleClass="mini-panel panel-grid tr panel-grid td panel-hover panel-header-title-small">
<div align="center">
<p:panelGrid columns="1">
<div class="component-spacing-top"/>
<h:graphicImage alt="#{business.businessName}" value="#{business.logoFullPath}" class="small-panel-image" />
<div class="component-spacing-top"/>
</p:panelGrid>
</div>
Run Code Online (Sandbox Code Playgroud)
有没有简单的方法可以将\ cast转换HttpError
为Exception
?
我正在考虑利用反射根据实例的内容实例化一个例外HttpError.Message
-这是完成我想做的最好的方法吗?
当我<h:form>
在下面提到的页面中单击标签的命令按钮时,我希望在我点击提交按钮后,查询参数作为请求参数发送,就像我的页面URL一样../index.xhtml?cid=12&ctype=video
.
我希望在我的动作方法中它应该被打印CID=12
,然而,它打印出来CID=NULL
.有什么问题,如何解决?
我的看法:
<h:body id="body">
<h:form id="form">
<p:commandButton action="#{authorizationBean.getParameters()}" value="Ajax Submit" id="ajax" />
</h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)
我的托管bean:
@ManagedBean
@SessionScoped
public class AuthorizationBean {
public boolean getParameters(){
Map<String, String> parameterMap = (Map<String, String>) FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
String cid = parameterMap.get("cid");
System.out.println("CID="+cid);
return true;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个简单的脚本,当我使用诸如 ^B 或 ^T 之类的热键时,它会为我编写简短的语句。问题是当它自己打字时,它会激活另一个热键,然后在它之后直接开始,所以我留下了一个双句。
^b::
hello, I am AutoHotKey.
^t::
What can I do for you?
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,“AutoHotKey”将触发第二个脚本,因为其中包含“t”并且它比不再按住控制键的输入速度更快。
有没有办法让一个功能独占,这样它就不能触发其他功能,或者我必须有完全不同的热键?
我使用ffmpeg.exe将视频文件转换为flv格式.为此,我使用Windows服务在后台运行转换过程.当试图通过Windows服务转换大文件(我在文件大小> 14MB时遇到它)时,它会卡在启动进程的行(即process.start();
).
但是,当我尝试直接从命令提示符执行ffmpeg.exe时,它解决了任何问题.
我的代码在Windows服务是为如下:
private Thread WorkerThread;
protected override void OnStart(string[] args)
{
WorkerThread = new Thread(new ThreadStart(StartHandlingVideo));
WorkerThread.Start();
}
protected override void OnStop()
{
WorkerThread.Abort();
}
private void StartHandlingVideo()
{
FilArgs = string.Format("-i {0} -ar 22050 -qscale 1 {1}", InputFile, OutputFile);
Process proc;
proc = new Process();
try
{
proc.StartInfo.FileName = spath + "\\ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = FilArgs;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false; …
Run Code Online (Sandbox Code Playgroud) 我在Python中有一个问题我无法绕过头脑,即使它很简单(我认为).
我正在尝试制作"弦乐系列".我真的不知道它叫什么,但它是这样的:
我想要一个能够使串联运行的字符串的函数,这样每次调用函数时它都会"计数"一次.
我有一个列表"a-z0-9 ._-"(a到z,0到9,点,下划线,短划线).我应该从我的方法收到的第一个字符串是aaaa,下次我打电话给它,它应该返回aaab,下次aaac等,直到我到达----
字符串的长度也是固定的,但应该很容易更改.
(在你查看我的代码之前,如果我的代码不符合约定,我想道歉;我几天前开始编写Python代码,所以我还是一个菜鸟).
我得到了什么:
生成可用字符列表
chars = []
for i in range(26):
chars.append(str(chr(i + 97)))
for i in range(10):
chars.append(str(i))
chars.append('.')
chars.append('_')
chars.append('-')
Run Code Online (Sandbox Code Playgroud)
获取序列中的下一个字符串
iterationCount = 0
nameLen = 3
charCounter = 1
def getString():
global charCounter, iterationCount
name = ''
for i in range(nameLen):
name += chars[((charCounter + (iterationCount % (nameLen - i) )) % len(chars))]
charCounter += 1
iterationCount += 1
return name
Run Code Online (Sandbox Code Playgroud)
它getString()
是需要修复的功能,特别是名称 …
我有以下语法.我想知道这部分$($(this).parent().siblings('div')[0])
是否可以通过直接访问jQuery对象而不需要$();
再次使用来更优雅地编写.
我使用.parent().siblings
并没有使用类,div
因为我想在类不同的地方重用代码.
$('textarea').click(function(){
$($(this).parent().siblings('div')[0]).html('<span>140</span>');
$($(this).parent().siblings('div')[1]).html('<span>Reply</span>');
});
<div class="post_area2">
<div class="wrap_area2 left">
<textarea></textarea>
</div>
<div class="word_c left"></div>
<div class="submit left"></div>
</div>
Run Code Online (Sandbox Code Playgroud) 如何在我的代码中添加第二个按钮MainActivity
?我知道我可能在这里很傻,但不知道我把代码放在第二个按钮链接到不同的活动.我的第一个按钮工作正常,只是不知道该怎么做第二个.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button buttonabout = (Button)findViewById(R.id.button3);
buttonabout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(),MainActivity2.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on …
Run Code Online (Sandbox Code Playgroud) 这个网站工作正常,但突然出现了错误.
意外的令牌( - 这意味着什么?看起来对我来说是正确的,并且已经好几个月了.
<script>
function (){ <--"Uncaught SyntaxError: Unexpected token (" here
$(".message").focus(function() {
$("#bubble").fadeOut();
}).blur(function() {
$("#bubble").fadeIn();
});
})();
</script>
Run Code Online (Sandbox Code Playgroud) javascript ×3
jsf ×3
primefaces ×3
.net ×2
android ×2
c# ×2
jquery ×2
jsf-2 ×2
autohotkey ×1
button ×1
css ×1
ffmpeg ×1
function ×1
get ×1
http ×1
httprequest ×1
java ×1
post ×1
python ×1
python-3.x ×1
send ×1