persistent

Persistent local domain socket in php

送分小仙女□ 提交于 2019-12-13 13:31:49
问题 The answers I've found to this question (such as here, here, and here) all involve pfsockopen(), which seems geared to non-local socket connections. However, the code I've written so far uses php to access a C++ server through a local connection. I want this connection to be persistent (so that I can use it for Comet, incidentally). Here's my non-persistent version: <?php session_start(); ... if (($sock = socket_create(AF_UNIX, SOCK_STREAM,0)) === false) { echo "socket_create() failed: reason

java create HTTP persistent connection

萝らか妹 提交于 2019-12-13 03:56:14
问题 I am trying to write a java program that will automatically download and name some of my favorite web comics. Since I will be requesting multiple objects from the same domain, I wanted to have a persistent http connection that I could keep open until all the comics have been downloaded. Below is my work-in-progress. How do I make another request from the same domain but different path without opening a new http connection? import java.io.BufferedReader; import java.io.IOException; import java

How to generalize a list with different EntityField values

萝らか妹 提交于 2019-12-13 02:25:35
问题 I try to generalize the URL handling when going to for example /api/v1.0/events?order=-id,title for a RESTful output - so the results will order by id desc, and than by title asc Models file: -- models Event title Text content Text userId UserId deriving Eq deriving Show Haskell file: -- Events.hs text2Order :: Text -> [SelectOpt Event] text2Order text = case lookup textWithNoPrefix keyVal of Just val -> [direction val] Nothing -> error "wrong order" where keyVal = [ ("title", EventTitle) , (

Keep the console script persistent in Google Chrome

只愿长相守 提交于 2019-12-12 19:26:20
问题 I have a script I want to use in the Google Chrome console. But this script is going to reload the page. A bit like this : setInterval(function(){location.reload();},3000); The problem is, once it's reloaded, the script stops and the console is cleared. I tried the option "Preserve log on navigation" : it preserves the log, but the script doesn't restart after reloading. How should I do ? Thanks :) 回答1: There is no way to actually do that. The only possible way I found is to develop a Chrome'

How do I make an ADODB.Connection Persistent in VBA in Excel?

旧街凉风 提交于 2019-12-12 17:20:56
问题 I have an Excel spreadsheet that needs to display data from our SQL database. I am storing the results of a slow query in a temporary table and want to be able to access those results repeatedly without having to rerun the slow query. I am using an ADODB.Connection in VBA to connect to our SQL database and retrieve information. I want to open a connection once and use that session across various macros for as long as the user is using the spreadsheet. I can't find any way to make the

Making Custom Instances of PersistBackend

僤鯓⒐⒋嵵緔 提交于 2019-12-12 13:25:09
问题 I have a monad transformer stack of the form: newtype T m a = T { unT :: StateT State (SqlPersist m) a } deriving (Monad, MonadState State) And want to use the persistent insert and lookup calls, so I need to make a PersistBackend instance for T . However, a phantom type encodes the specific backend into the Key return type - this causes some extra headaches. To solve the phantom type issue, my instance has the form: instance (Monad m, MonadIO m, MonadBaseControl IO m) => PersistBackend T m

How to fix: The tcp server having close waits after client disconnected

只谈情不闲聊 提交于 2019-12-11 16:07:36
问题 I am having tcp server which gets hanged with "Close_Waits". I need to have an example program which deals with the persistent connection from the client. I have tried catching the exceptions and then closing the socket inside the catch. But no luck! protected virtual void ReceiveCallBack(IAsyncResult result) { var wrapper = (ConnectedSocketWrapper)result.AsyncState; try { int bytesRead = 0; bytesRead = wrapper.ConnectedSocket.EndReceive(result); LogInfo("Byte Read" + bytesRead.ToString());

How to clear a persistent variable in a MATLAB method

限于喜欢 提交于 2019-12-11 12:44:48
问题 I have a MATLAB class that contains a method that employs a persistent variable. When certain conditions are met I need to clear the persistent variable without clearing the object to which the method belongs. I've been able to do this, but only by employing clear functions which has excessively broad scope for my purposes. The classdef .m file for this problem: classdef testMe properties keepMe end methods function obj = hasPersistent(obj) persistent foo if isempty(foo) foo = 1; disp(['set

objective-c sqlite3 database changes not persistent

那年仲夏 提交于 2019-12-11 04:36:23
问题 I have an SQLite database for my app. To retrieve the entities from the db I use this method: - (sqlite3*) openDatabaseNamed:(NSString*)databaseName { if(![databaseName isEqualToString:kTopInternationalDatabaseName] && ![databaseName isEqualToString:kTop500RODatabaseName]){ NSAssert(nil, @"Database does not exist!"); } sqlite3 * dataBase; NSString * path; path = [[NSBundle mainBundle] pathForResource:databaseName ofType:@"sqlite3"]; if (sqlite3_open([path UTF8String], &dataBase) != SQLITE_OK)

Can I make a “global” object to store variables for multiple objects?

拜拜、爱过 提交于 2019-12-11 03:58:50
问题 I am creating a graphing application that will display several graphs. The graphs will need access to some global data and some graph-specific data. For example, I want the colors consistent, so that would be global, but the specific graphs can have different grid spacing (per graph). I created a "master object" with set defaults and a derived object with per graph configuration options class GraphMasterObject { public Color gridcolor = Color.Red; } class GraphObject : GraphMasterObject {