我一直在试图建立的PostgreSQL我的系统上(OSX 10.8,干净的安装),但我遇到了麻烦,使用psql,createdb等等.我已经尝试了各种解决方案,并没有似乎工作.
安装成功,我继续使用以下方法修复已知的套接字问题:
mkdir /var/pgsql_socket
sudo chown $USER /var/pgsql_socket
Run Code Online (Sandbox Code Playgroud)
然后我编辑postgresql.conf,设置unix_socket_directory为
unix_socket_directory = '/var/pgsql_socket'
Run Code Online (Sandbox Code Playgroud)
并重新启动Pg.
这应该显然已经解决了套接字问题,但我仍然得到:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
此外,我已经检查了服务器的状态,它似乎正在运行,但我仍然得到'没有这样的文件或目录'
有任何想法吗?
我的设置如下:在我的onCreate内部我初始化一个ArrayList,如下所示:
textList = new ArrayList<HashMap<String, String>>();
// unrelated code ...
if (isConnected()) {
new DisplayTextTask().execute(sectionId);
}
Run Code Online (Sandbox Code Playgroud)
并且AsyncTask通过提取文本HttpURLConnection(),使用解析json JsonReader,并将每行文本添加到textList(所有这些都发生在AsyncTask中doInBackground.我有一个自定义适配器,显示字符串在textList.
gotoNextSection()当用户想要导航到下一页时,我还有一个触发的功能,我在这里执行以下操作:
gotoNextSection() {
if (isConnected()) {
new DisplayTextTask().execute(sectionId+1);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,由于我不希望上一页中的陈旧文本保留在屏幕上,因此我在AsyncTask中执行以下操作:
private class DisplayTextTask extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
textList.clear();
}
@Override
protected String doInBackground(String... urls) {
// json parsing is called in getData()
try {
return getData(urls[0]);
} catch (IOException e) {
return "Could not load text"; …Run Code Online (Sandbox Code Playgroud) java android arraylist android-asynctask android-6.0-marshmallow