我刚下载并安装了新的Android SDK.我想创建一个简单的应用程序来测试它.
该向导创建了此代码:
package eu.mauriziopz.gps;
import android.app.Activity;
import android.os.Bundle;
public class ggps extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Run Code Online (Sandbox Code Playgroud)
但Eclipse给了我错误
R无法解决
在线
setContentView(R.layout.main);
Run Code Online (Sandbox Code Playgroud)
为什么?
PS:我有一个名为XML文件main.xml下res/layout/.
eclipse android compiler-errors android-sdk-tools android-resources
我正在尝试创建一个多线程服务器.问题是我收到以下错误: play.exceptions.JPAException:JPA上下文未初始化.当在应用程序中找到使用@ javax.persistence.Entity批注注释的一个或多个类时,JPA实体管理器会自动启动.
我要做的是从新线程访问数据库这里是代码
package controllers;
import java.util.Iterator;
import java.util.List;
import models.Ball;
public class MainLoop extends Thread {
@Override
public void run() {
List<Ball> balls;
new Ball(5,5,2,2,10,15);
while (true){
balls = Ball.all().fetch(); //Here throws an exception
for (Iterator iterator = balls.iterator(); iterator.hasNext();) {
Ball ball = (Ball) iterator.next();
ball.applyForces();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
是否有可能用Java编写一个防病毒程序,例如它可以拦截程序被执行?我可以在Java中对操作系统进行如此深入的控制吗?
更新:c#怎么样?同样的限制适用或更好的方式?
我正在尝试在www.example.com和admin.other.example.com之间共享一个cookie我已经能够使用other.example.com,但是没有办法访问子子域
编辑:我通过将cookie域定义为.example.com来处理子域(请注意第一个点)
嗨,我正在尝试运行一个简单的测试,取代每个的Features.Count SPSite,但我不能.你能帮助我吗?
我有这个代码:
[TestMethod]
public void AllInstances()
{
using (var context = new SPEmulationContext(IsolationLevel.Fake))
{
ShimSPSite.AllInstances.FeaturesGet = (item) =>
{
return new ShimSPFeatureCollection()
{
CountGet = () => 1
}.Instance;
};
var tSite = new SPSite("http://fakesite");
Assert.AreEqual(1, tSite.Features.Count);
}
}
Run Code Online (Sandbox Code Playgroud)
但它失败了这个例外:
Microsoft.QualityTools.Testing.Fakes.Shims.ShimNotImplementedException:抛出了类型'Microsoft.QualityTools.Testing.Fakes.Shims.ShimNotImplementedException'的异常.
这个类似的工作正常
[TestMethod]
public void Shim()
{
using (var context = new SPEmulationContext(IsolationLevel.Fake))
{
var tSite = new ShimSPSite()
{
FeaturesGet = () =>
{
return new ShimSPFeatureCollection()
{
CountGet = () => 1
}.Instance;
}
}.Instance;
Assert.AreEqual(1, …Run Code Online (Sandbox Code Playgroud) 我正在为Android操作系统开发一个应用程序,我刚开始,但我无法在模拟器上运行GPS.我已经在互联网上读到你需要向模拟器发送地理定位以启用gps locationProvider.我都在使用DDMS和telnet来尝试发送它,但是logcat从未告诉我它已经恢复了一个新的修复程序,而我的apolication仍然认为gps是禁用的
这是我的代码
package eu.mauriziopz.gps;
import java.util.Iterator;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
public class ggps extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager l =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
List<String> li = l.getAllProviders();
for (Iterator<String> iterator = li.iterator(); iterator.hasNext();) {
String string = iterator.next();
Log.d("gps", string);
}
if (l.getLastKnownLocation("gps")==null)
Log.d("gps", "null");
}
}
Run Code Online (Sandbox Code Playgroud)
我已经读过DDMS可能无法在非英语操作系统上正常工作,但telnet应该可以工作!
更新:在设置中启用了gps
嗨,我正在尝试使用wsdl api来计算我的网站的运费.我正在使用opencart和这个模块(http://www.opencart.com/index.php?route=extension/extension/info&extension_id=2055&filter_search=fedex&sort=e.date_modified&order=DESC).结帐时我收到此错误:
WARNING::556::There are no valid services available.
Run Code Online (Sandbox Code Playgroud)
但我尝试在联邦快递网站上的计算器上进行相同的处理,它给了我两项服务:国际优先和国际经济
这是我的调试数据:
Array
(
[WebAuthenticationDetail] => Array
(
[UserCredential] => Array
(
[Key] => REDACTED
[Password] => REDACTED
)
)
[ClientDetail] => Array
(
[AccountNumber] => REDACTED
[MeterNumber] => REDACTED
)
[TransactionDetail] => Array
(
[CustomerTransactionId] => *** Rate Request v9 using PHP ***
)
[Version] => Array
(
[ServiceId] => crs
[Major] => 9
[Intermediate] => 0
[Minor] => 0
)
[ReturnTransitAndCommit] => 1
[RequestedShipment] => Array
(
[DropoffType] => REQUEST_COURIER …Run Code Online (Sandbox Code Playgroud) 当手机靠近某个位置时,我正试图更新并更新.我都尝试过使用addProximityAlert和requestLocationUpdates
LocationManager lm =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location l = lm.getLastKnownLocation("gps");
Intent intent = new Intent("eu.mauriziopz.gps.ProximityAlert");
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
lm.addProximityAlert(12, 12, 100, 1000000, pIntent);
Run Code Online (Sandbox Code Playgroud)
这个从不激发意图(我知道它可以工作,因为我可以手动启动它).我尝试使用一个监听器但它只执行一次.无论我多少次更新gps,它都不会被再次调用
ProximityListener pl = new ProximityListener();
lm. requestLocationUpdates("gps", 2000, 10, pl);
Run Code Online (Sandbox Code Playgroud)
这是活动的代码(在第一种情况下调用)
public class ProximityAlert extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
Log.d("intent", "Hi");
finish();
}
Run Code Online (Sandbox Code Playgroud)
这是听众
public class ProximityListener implements LocationListener {
String DEBUG_TAG = "ProximityListener";
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated …Run Code Online (Sandbox Code Playgroud) 如何验证输入元素中是否包含任何文本.它加载了随机文本,因此我无法验证特定值,但必须有一些文本.我正在使用Selenium IDE
我用以下命令安装了phonegap cli:
sudo npm install -g phonegap
Run Code Online (Sandbox Code Playgroud)
当我输入
phonegap create testApp
Run Code Online (Sandbox Code Playgroud)
它什么都不做,它不输出任何内容,也没有错误消息.我已经尝试重新安装它,安装cordova,但没有.
我正在研究kubuntu 13.10
有任何想法吗?
我从javascript中得到一个奇怪的行为,任何人都可以帮助我?
当我点击"测试"链接时,我收到一个包含此字符串的警告:"[]"
我期待的是:"[{'temp':25},{'thermState':'Notte'}]"
我究竟做错了什么?
<html>
<head>
<script type="text/javascript" charset="utf-8" src="js/json2.js"></script>
<script type="text/javascript" charset="utf-8">
function test(){
this.radioStates="";
this.state = [];
this.state["temp"]=25;
this.state["thermState"]="Notte";
alert(JSON.stringify(this.state));
}
</script>
</head>
<body>
<a href="#" onclick="test()">test</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在使用以下函数将文件上传到具有 Angular 7 HttpClient 的服务器
pushFileToStorage(productId, key, file: File): Observable<any> {
let formdata: FormData = new FormData();
formdata.append('prod', file);
let url_ = '/admin5/api/v1/product/images/upload?';
url_ += "productId=" + encodeURIComponent("" + productId) + "&";
url_ += "kind=" + encodeURIComponent("" + key);
return this.http.post(url_,formdata);
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是 HttpClient 设置了错误的内容类型标头(application/json 而不是“multipart/form-data”),因此服务器无法读取文件。这是我在开发者工具上看到的
知道我做错了什么吗?谢谢
编辑:我想添加值到一个表(paziente)使用该表的视图(viewPaziente),而不是直接在表中。
edit2:在代码中发现了一个愚蠢的错误,现在它确实给了我一个错误,但没有帮助:
org.h2.jdbc.JdbcSQLException:不支持的功能:“ VIEW”; SQL语句:INSERT INTO“ viewPaziente”值(?,?,?,?,?,?,?,?,?,?,?,?,?)[50100-147]
是否可以在表视图中插入行?
我的意思是…我有一个包含许多字段的“ paziente”表,我创建了一个Paziente视图,并且想通过该视图向paziente添加一行。在H2中可以这样做吗?
我正在使用以下代码
public static boolean AddAnagrafica(String nome, String cognome,
String data, String telefono, String email,String codiceFiscale, boolean isDonna, String indirizzo, String citta,
String provincia, String cap, String paese ){
Connection conn=null;
try {
conn = getConnection();
PreparedStatement st = conn.prepareStatement("INSERT INTO \"viewPaziente\" values(?,?,?,?,?,?,?,?,?,?,?,?,?)");
st.setInt(1, new Random().nextInt());
st.setString(2,nome);
st.setString(3,cognome);
st.setString(4,data);
st.setString(5,telefono);
st.setString(6,email);
st.setString(7,codiceFiscale);
st.setBoolean(8,isDonna);
st.setString(9,indirizzo);
st.setString(10,citta);
st.setString(11,provincia);
st.setString(12,cap);
st.setString(13,paese);
st.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
Run Code Online (Sandbox Code Playgroud)