identify groups of linked episodes which chain together

The Bioconductor package RBGL (an R interface to the BOOST graph library) contains a function, connectedComp(), which identifies the connected components in a graph — just what you are wanting. (To use the function, you will first need to install the graph and RBGL packages, available here and here.) library(RBGL) test <- data.frame(id1=c(10,10,1,1,24,8),id2=c(1,36,24,45,300,11)) ## Convert … Read more

How to preserve identifierForVendor in ios after uninstalling ios app on device?

You may keep it in KeyChain -(NSString *)getUniqueDeviceIdentifierAsString { NSString *appName=[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; NSString *strApplicationUUID = [SSKeychain passwordForService:appName account:@”incoding”]; if (strApplicationUUID == nil) { strApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; [SSKeychain setPassword:strApplicationUUID forService:appName account:@”incoding”]; } return strApplicationUUID; }

Is there a spec that the id of elements should be made global variable?

It depends on which spec you read. 🙂 This behavior is not described by the HTML4 specification (c.f., http://www.w3.org/TR/1999/REC-html401-19991224/struct/global.html#adef-id and http://www.w3.org/TR/1999/REC-html401-19991224/types.html#type-name). However, it was introduced by Internet Explorer and then copied in other major browsers for compatibility. FireFox also displays this behavior, but only in quirks mode (and even then its implementation seems buggy). The … Read more

Table name as a PostgreSQL function parameter

This can be further simplified and improved: CREATE OR REPLACE FUNCTION some_f(_tbl regclass, OUT result integer) LANGUAGE plpgsql AS $func$ BEGIN EXECUTE format(‘SELECT (EXISTS (SELECT FROM %s WHERE id = 1))::int’, _tbl) INTO result; END $func$; Call with schema-qualified name (see below): SELECT some_f(‘myschema.mytable’); — would fail with quote_ident() Or: SELECT some_f(‘”my very uncommon table … Read more

Are PostgreSQL column names case-sensitive?

Identifiers (including column names) that are not double-quoted are folded to lowercase in PostgreSQL. Column names that were created with double-quotes and thereby retained uppercase letters (and/or other syntax violations) have to be double-quoted for the rest of their life: “first_Name” Values (string literals / constants) are enclosed in single quotes: ‘xyz’ So, yes, PostgreSQL … Read more

What is the meaning of single and double underscore before an object name?

Single Underscore Names, in a class, with a leading underscore are simply to indicate to other programmers that the attribute or method is intended to be private. However, nothing special is done with the name itself. To quote PEP-8: _single_leading_underscore: weak “internal use” indicator. E.g. from M import * does not import objects whose name … Read more