connection

Error in http connection android.os.networkonmainthreadexception

喜欢而已 提交于 2019-12-13 20:31:15
问题 I wrote app for android and i have one problem. It works on phone, but it doesn't work on tablet. I have Error : Error in http connection android.os.networkonmainthreadexception. It is my code: public class AktualizacjaActivity { public static final String KEY_121 = "http://xxx.php"; public String getServerData(String returnString,Context context) { DatabaseAdapter db1 = new DatabaseAdapter(context); db1.open(); String question=""; try { Cursor c = db1.makeCursor(DatabaseAdapter.STRUCT, new

Can't connect to SQL Server 2005

♀尐吖头ヾ 提交于 2019-12-13 18:40:07
问题 I just installed SQL Server 2005 on my machine and now I am trying to connect to it via SQuirrel SQL, but I am unfortunately running into problems. When installing SQL Server 2005 I chose mixed mode for authentication and I have set up a new user account with which I am trying to connect. I also have installed the Microsoft SQL Server JDBC Driver and I have successfully used SQuirrel SQL to connect to a remote server before. Currently I am trying to connect to my database by specifying jdbc

Android http request not working with WiFi but working on mobile data

爱⌒轻易说出口 提交于 2019-12-13 17:40:23
问题 I'm having trouble getting a response from a http request when the phone is connected via WiFi. When it's using mobile data everything works fine. Here is the code: doc = Jsoup.connect("https://www.facebook.com/") .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .referrer("http://www.google.com") .get(); I get java.net.SocketTimeoutException:Read timed out exception. I have added these permissions in my manifest file: <uses-permission

Where/How do I handle different connection types using Repository Pattern with ADO.Net?

╄→гoц情女王★ 提交于 2019-12-13 17:24:16
问题 I am new to the repository pattern but am creating a repository to connect to two different database types that have the same data structure. Where and how should I handle the connection? Here are my requirements/constraints/project description I will be connecting to SQL Server 2005 and DB2 (on Iseries) I will be using the repository in a WPF application. Although I would like to use Entity Framework, I cannot. This is because IBM charges a rediculous $11,000 for a product called DB2 Connect

FileStream.copyTo(Net.ConnectStream) what happens intern?

对着背影说爱祢 提交于 2019-12-13 15:31:28
问题 this code works fine. My question is what happens within the Net.ConnectionStream when i use the CopyTo() method? System.Net.HttpWebRequest request using (FileStream fileStream = new FileStream("C:\\myfile.txt") { using (Stream str = request.GetRequestStream()) { fileStream.CopyTo(str); } } More specific: What happens to the data? 1. write into the memory and upload then? (what's with big files?) 2. write into the network directly? (how does that work?) Thanks for your answers 回答1: It creates

How do I implement getConnection() in DataSource in Java?

眉间皱痕 提交于 2019-12-13 14:17:11
问题 I'm reading up on DataSource, here, and trying to implement it in my own little project by using a simple file as my "data source". I've created a class that is pretty simple at the moment... public class QueueData implements DataSource { ... } though the reason it is simple is because I haven't been able to find a resource that explains how the implemented methods should work. Everyone seems to just list the initialization of a context and a magical getConnection() call, like so. Context ctx

How connect to SQL Server Compact 4.0 in ASP.NET?

大憨熊 提交于 2019-12-13 12:55:33
问题 I want connect to SQL Server Compact 4.0 in my ASP.NET application. Here is example of code: protected void Page_Load(object sender, EventArgs e) { string connStr = "Data Source=D:\\MyDB.sdf;"; string sqlStr = "select * from tblMyTable"; var sqlDataSrc = new SqlDataSource(connStr, sqlStr); GridWithUrls.DataSource = sqlDataSrc; GridWithUrls.DataBind(); } But I have the next error: "A network-related or instance-specific error occurred while establishing a connection to SQL Server.The server

How to send internet packets between two Arduinos?

本小妞迷上赌 提交于 2019-12-13 07:49:02
问题 For a project I am working on, I am wondering if there is a way to send internet packets between two Arduinos. The setup would be to have both Arduinos have ethernet shields. One shield is connected to a computer and the other to a router or other internet connection. The Arduinos need to communicate to each other relaying the packets of information. The goal is to be able to ping the router from my computer through these two Arduinos. Any help would be greatly appreciated. Thank you. 回答1:

run psql query in bash

只谈情不闲聊 提交于 2019-12-13 07:43:21
问题 I am new in bash and psql, I want to write a bash code that login a server the connect to psql database do a select query and then return the output. the set up I have as follow. server named dbs, it has psql install and running. database name = dname, user= tester passwrod = 1234 in the database there is table called node_info it has 3 colons ip, mac, connection_time. I want to run following query select ip, connection_time from node_info where ip=10.10.10.2; Any tips how to write a shell

A way to access common FTP connection resource pool in Ruby across AJAX calls?

末鹿安然 提交于 2019-12-13 07:36:07
问题 I have a web application which establishes many FTP or SFTP connections with outside servers. Its interface uses AJAX, and via AJAX I get file listings on remote FTP servers and return those to the client browser. Each time I run an AJAX call, I have to reconnect to the remote server and reauthenticate. This takes a ton of extra time. Is there a way I can somehow store FTP connection resource objects in some common memory pool and re-access to the connection resource objects with future AJAX