Posts

java - Is it safe to keep a reference to a thread in a singleton? -

let me give scenario. say first activity loads up, creates thread, run indefinitely in background. now, if move activity, assume thread created in main activity continue run. so, main question - in order manage background thread other activities, safe store reference thread in singleton object? yes , no. theoretically, have no problem, must not allow references escape. problems can arise keeping reference in singleton object private, must not pass reference else or allow access else, or can lose control. secondly, thread created activity must not allow access member variables or allow references them escape. a book on area "java concurrency in practice" brian goetz

wpf - SurfaceCheckBox default template -

can please extract default template of surfacecheckbox me? have tried using blend 2 failed miserably. extracted template has unresolved targetname references. i trying change template check mark top aligned. centered vertically default , there doesn't seem direct way change it. [edit] have tried blend 3 bit better still missing "glow" target , many references it. renders template unusable unless "glow" references removed. if working template no glow. from blend 4. working time, apperently had add reference microsoft.surface.presentation.generic.dll , add xmlns:microsoft_surface_presentation_generic="clr-namespace:microsoft.surface.presentation.generic;assembly=microsoft.surface.presentation.generic" before glow part when editing style. <!-- simplebuttonfocusvisual used show keyboard focus around simplebutton control --> <style x:key="surfacebuttonfocusvisual"> <setter property="control.template...

How can I combine multiple refactored Select expressions in Linq (to EF or SQL)? -

say have view model: public class serieslinkviewmodel { public static expression<func<series, serieslinkviewmodel>> fromseries = s => new serieslinkviewmodel { name = s.name, slug = s.slug, }; public string name { get; set; } public string slug { get; set; } } i stuck projection function in there convenience, can like: var links = dc.series.select(serieslinkviewmodel.fromseries); awesome. do if wanted add query? wanted pull description column table. normally, select new { } , put description in there, can't quite because can put 1 projection function in `.select() . i hoping this: q = s in dc.series select new { series = serieslinkviewmodel.fromseries.compile()(s), description = s.description }; but exception: system.invalidcastexception: unable cast object of type 'system.linq.expressions.fieldexpression' type 'system.linq.expression...

Java iText Geospatial PDF exporter -

i'm planning use java itext library generate geospatial pdf (http://en.wikipedia.org/wiki/geospatial_pdf). there basic support in itext, have not found high level api. people trying directly use adobe format extensions. http://www.mail-archive.com/itext-questions@lists.sourceforge.net/msg40443.html do know easier solution? thanks in advance, regards, until itext adds high-level api calls it, option dive low level objects (pdfobject's subclasses) copy of pdf specification handy, turned relevant section... err... must in 1 of addendums... ah! here is. , under "part 1:..."->interactive features...->8.8 measurement properties->8.8.1 geospatial features. i wish luck.

How to get title of preferencescreen in android -

i trying gate title of preferencesreen in program ..anybody tell me how can title? code of preference xml here. want title "show list" in program. <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android"> <preferencecategory android:title="settings"> <preferencescreen android:title="show list" android:key ="show_list" android.id="@+id/preference_screen"> <intent android:action="android.intent.action.view" android:targetpackage="com.picknext" android:targetclass="com.picknext.pickname" /> </preferencescreen> <listpreference android:title="remove after pick" android:key="selection_of_y_n_name_pick" android:entries="@array/selection_of_y_n_namepick" andro...

c# - Mono.Cecil TypeReference to Type? -

is there anyways go typereference in mono.cecil type? in terms of "what's in box" can have other way round, using moduledefinition.import api. to go typereference system.type need manually using reflection , assemblyqualifiedname . aware cecil uses il conventions escape nested classes etc, need apply manual correction. if want resolve non-generic, non-nested types should fine though. to go typereference typedefition (if that's meant) need to typereference.resolve(); requested code sample: typereference tr = ... type.gettype(tr.fullname + ", " + tr.module.assembly.fullname); // in assemnblies loaded current appdomain , fire appdomain.resolve event if no type found the conventions used in reflection explained here , cecils conventions consult cecil source code.

php - Zend_Soap_Client error calling ASP.net web service: '...not set to an instance of an object' -

i'm trying use zend_soap_client communicate asp.net web service. here's client call: $client = new zend_soap_client(null, array( 'location' => 'http://example.com/service.asmx', 'uri' => 'http://example.com/' )); $user = new userdetail(); $result = $client->userdetails($user); however gives me error: system.nullreferenceexception: object reference not set instance of object. @ service.userdetails(userdetail userdetail) some googling revealed quite common problem. common solution seemed to pass parameters array, tried: $result = $client->userdetails(array('userdetail' => $user)); but gave same error. tried passing params stdclass object, nesting array in 'params' key, , few other things error same. i have asp code web service itself, relevant method is: public result userdetails(userdetail userdetail) { [some stuff] hashtable ht = new hashtable(); ht = userdetail.generat...