我尝试用socket连接到我的服务器.我的服务器在端口8080上运行带有Rachet的服务器套接字.我尝试运行此代码:
<script>
try{
conn = new WebSocket('wss://localhost:8080');
conn.onclose = function (e)
{
//checkUser();
}
conn.onopen = function(e)
{
console.log("test");
};
}catch (error)
{
console.log(error);
}
</script>
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
WebSocket connection to 'wss://localhost:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Run Code Online (Sandbox Code Playgroud)
当我尝试从我的linux shell连接时,我得到了这个:
root@(none):~# telnet localhost 8080
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Run Code Online (Sandbox Code Playgroud) 我昨晚(31.4)更新了我的Android SDK,之后我再编辑我的应用了.我收到此错误:
[2015-05-01 14:36:24 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command$1;
[2015-05-01 14:36:24 - SoFit] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command$1;
Run Code Online (Sandbox Code Playgroud)
我的罐子里没有任何改变.这是我的libs结构:

我试图: - 清理项目. - 重启eclipse. - 删除bin文件夹. - 删除私人图书馆.
我还试图删除谷歌分析师jar,因为我从最近的谷歌播放服务更新,他们把分析师放在lib里面.但由于缺少类,它也不会编译.
我猜这个谷歌游戏服务的东西是错的,但我找不到什么.
你好我试图使用CSS为我的页面使用背景.图像来自另一个文件夹,我尝试将她引用到CSS文件.
CSS文件URL为:/ var/www/soFit/BO
图像文件URL为:/ var/www/soFit/BO/images/login
我的CSS文件:
#login-bg
{
background-image:url('/images/login/login_background.jpg');
font-size: 20px;
}
Run Code Online (Sandbox Code Playgroud)
我的HTML代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body id="login-bg">
<form action="" method="POST">
Username: <input type="text" name="username" >
<br>
Password: <input type="text" name="password" >
<br>
<input type="submit" value="enter">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
为什么我看不到我的背景图片?
我使用SimpleDateFormat来解析正确的日期.
有时当我使用SimpleDateFormat时,它会以英语之外的其他语言返回日期.
我希望日期字符串只有英文.有可能吗?
看我的代码和图片.
这是我的形成者:
SimpleDateFormat df = new SimpleDateFormat("d-MMMM-yyyy", Locale.ENGLISH);
Run Code Online (Sandbox Code Playgroud)
这是相同的应用程序,但字符串使用不同的语言:


谢谢你的帮助
我尝试使用NetBeans 8将FTP连接到我的服务器.
我的问题是我收到此错误:
Because NetBeans is running on Windows and JDK 7, you might be facing a problem with FTP operations. Ensure that Windows built-in firewall does not block JDK 7 binaries
Run Code Online (Sandbox Code Playgroud)
我用google搜索了这个错误,发现了这个问题:
https://netbeans.org/bugzilla/show_bug.cgi?id=201449
http://support.microsoft.com/kb/2754804
http://www.nemesis.co.nz/2013/02/netbeans-jre7-and-windows-firewall/
他们似乎都不适合我.我有Windows 7家庭高级64位与java 7
当我尝试使用WinSCP将FTP连接到我的服务器时,它的工作正常.

我尝试使用我的操作栏,我得到了这个execption
08-08 00:54:08.913: E/AndroidRuntime(18468): FATAL EXCEPTION: main
08-08 00:54:08.913: E/AndroidRuntime(18468): java.lang.ClassCastException: android.support.v7.widget.ShareActionProvider cannot be cast to android.view.ActionProvider
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.MenuInflater$MenuState.readItem(MenuInflater.java:374)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.MenuInflater.parseMenu(MenuInflater.java:160)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.MenuInflater.inflate(MenuInflater.java:110)
08-08 00:54:08.913: E/AndroidRuntime(18468): at com.example.workoutlog.AddWorkOutPage.onCreateOptionsMenu(AddWorkOutPage.java:3190)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.app.Activity.onCreatePanelMenu(Activity.java:2490)
08-08 00:54:08.913: E/AndroidRuntime(18468): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:460)
08-08 00:54:08.913: E/AndroidRuntime(18468): at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:822)
08-08 00:54:08.913: E/AndroidRuntime(18468): at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:253)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.Choreographer.doFrame(Choreographer.java:531)
08-08 00:54:08.913: E/AndroidRuntime(18468): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
08-08 00:54:08.913: E/AndroidRuntime(18468): …Run Code Online (Sandbox Code Playgroud) 我试图通过使用压缩方法来减少位图大小.
这是我的代码:
public Bitmap compressImage(Bitmap image) {
Bitmap immagex = image;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Log.i("before compress", immagex.getByteCount()+"");
boolean compress = immagex.compress(Bitmap.CompressFormat.JPEG, 10, baos);
if(compress)
Log.i("after compress", immagex.getByteCount()+"");
else
Log.i("bad compress", "bad compress");
return immagex;
}
Run Code Online (Sandbox Code Playgroud)
当我检查我的日志时,我得到:
11-28 11:10:38.252: I/before compress(2429): 374544
11-28 11:10:38.262: I/after compress(2429): 374544
Run Code Online (Sandbox Code Playgroud)
为什么压缩不起作用?
更新:
我试过这段代码:
public Bitmap compressImage(Bitmap image) {
Bitmap immagex = image;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Log.i("before compress", immagex.getByteCount()+"");
boolean compress = immagex.compress(Bitmap.CompressFormat.JPEG, 10, baos);
Log.i("after compress 2", decodeSampledBitmapFromByte(image.getWidth(), image.getHeight(), baos.toByteArray()).getByteCount()+""); …Run Code Online (Sandbox Code Playgroud) 我试图改变AlertDialog.Builder的按钮颜色,但我没有找到一种方法来做到这一点.
我希望将按钮的颜色和标题更改为白色,就像在HOLO主题中一样.
请参阅以下2个屏幕截图作为示例:


我看过这里:
所有这些都不适合我.
这是我的代码:
public void logInDialog()
{
ContextThemeWrapper ctw = new ContextThemeWrapper( this, R.style.dialogStyle);
AlertDialog.Builder builder = new AlertDialog.Builder(ctw);
builder.setTitle("Log in");
View prefView = View.inflate(this, R.layout.log_in, null);
//The rest of the code.........
}
Run Code Online (Sandbox Code Playgroud)
这是我的样式代码:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="dialogStyle" parent="android:Theme.Dialog">
<item name="android:background">@color/white</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:button">@color/white</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud) 您好我试图使用PHP将文件从我的Android应用程序上传到我的服务器.
我看过这篇文章:
如何使用与PHP一起使用的Java HttpClient库上传文件 http://www.veereshr.com/Java/Upload 如何使用http将Android中的文件从移动设备发送到服务器?
这是我的JAVA代码:
public void upload() throws Exception {
File file = new File("data/data/com.tigo/databases/exercise");
Log.i("file.getName()", file.getName());
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://***.***.***.***/backDatabase.php");
InputStreamEntity reqEntity = new InputStreamEntity( new FileInputStream(file), -1);
reqEntity.setContentType("binary/octet-stream");
reqEntity.setChunked(true);
httppost.setEntity(reqEntity);
HttpResponse response = httpclient.execute(httppost);
if((response.getStatusLine().toString()).equals("HTTP/1.1 200 OK")){
// Successfully Uploaded
Log.i("uploaded", response.getStatusLine().toString());
}
else{
// Did not upload. Add your logic here. Maybe you want to retry.
Log.i(" not uploaded", response.getStatusLine().toString());
}
httpclient.getConnectionManager().shutdown();
}
Run Code Online (Sandbox Code Playgroud)
这是我的PHP代码:
<?php
$uploads_dir = '/tigo/databaseBackup'; …Run Code Online (Sandbox Code Playgroud) 我想从 BigQuery 迁移到 CloudSQL 以节省成本。我的问题是,与 BigQuery 相比,带有 PostgreSQL 的 CloudSQL 非常慢。在 BigQuery 中需要 1.5 秒的查询在带有 PostgreSQL 的 CloudSQL 上需要近 4.5 分钟(!)。
我有 CloudSQL 和 PostgreSQL 服务器,配置如下:
我的数据库有一个包含 16M 行的主表(RAM 约为 14GB)。
查询示例:
EXPLAIN ANALYZE
SELECT
"title"
FROM
public.videos
WHERE
EXISTS (SELECT
*
FROM (
SELECT
COUNT(DISTINCT CASE WHEN LOWER(param) LIKE '%thriller%' THEN '0'
WHEN LOWER(param) LIKE '%crime%' THEN '1' END) AS count
FROM
UNNEST(categories) AS param
) alias
WHERE count = 2)
ORDER BY views DESC
LIMIT 12 OFFSET 0 …Run Code Online (Sandbox Code Playgroud)