Posts

Showing posts from January, 2012

How to get the image name of the ImageView in Android? -

i have imageview in android . want name of image set in in imageview. how can ? imageview v = (imageview)findviewbyid(r.id.img); //string name = findimagename(v); if( name.equals(a)) { //do } else{ //do } for first of need set tag imageview <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview1" android:background="@drawable/bg1" android:tag="bg1"/> now image name set on imageview doing following, imageview v = (imageview)findviewbyid(r.id.img); string backgroundimagename = string.valueof(v.gettag()); and should return image tag name "bg1" . now compare tag names or use further process if( backgroundimagename.equals(bg1)) { //do } else{ //do }

operating system - Get Key Code of Pressed Key from Python -

is possible python read key (such enter or escape or arrow key) pressed user , record keycode of key in variable? i looked @ python key binding/capture displays character press in shell. want record value in variable, no need print (and not python '\n' enter real keycode (like 13 think on windows) enter key). this works me. @mosherabaev right , code version. guess have find characters special keys (like '\r' enter). no clue characters arrow keys though... import wx user_input = str(raw_input()) user_input += '\r' #if press enter key print user_input if ord(user_input) == wx.wxk_return: print "hey" print "what"

java - NPE when using CamelBlueprintTestSupport -

i want create integration test camelblueprinttestsupport. start camelcontext looks ok @ first: [ main] ingrestjobadvertapioffirstbird info skipping starting camelcontext system property skipstartingcamelcontext set true. [ main] blueprintcamelcontext info apache camel 2.15.1.redhat-620133 (camelcontext: camel-1) starting routes starting. message within console: in main loop, have serious trouble: java.lang.nullpointerexception java.lang.nullpointerexception @ org.apache.felix.fileinstall.internal.directorywatcher.run(directorywatcher.java:303) camel version: 2.15.1.redhat-620133 the unit test: public class whenusingrestjobadvertapiofdemo extends camelblueprinttestsupport { @override protected string getblueprintdescriptor() { return "osgi-inf/blueprint/blueprint.xml"; } @override protected string[] loadconfigadminconfigurationfile() { return new string[]{"src/test/re

xslt - Test for result tree fragment -

i'm trying create template either presents content, or inserts placeholder indicate absence of content: <xsl:template name="information"> <xsl:param name="content"> <xsl:choose> <xsl:when test="$content"> <content> <xsl:apply-templates select="$content/node()" /> </content> </xsl:when> <xsl:otherwise> <placeholder/> </xsl:otherwise> </xsl:choose> </xsl:template> this works well, until content result tree fragment: <xsl:call-template name="information"> <xsl:with-param name="content">yes</content> </xsl:call-template> i'm using microsoft .net xslt engine, can call msxsl:node-set() on parameter obtain workable node-set, don't know how test if parameter needs treatment. far lesser case content generated.

matlab - For each vector of the cell A, How to find all possible combinations of its components that are not contained in vectors of the cell B? -

for each vector of cell a , how find possible combinations of components not contained in vectors of cell b ? = {[2 3 6 21],[66 4 2 7],[84 56 66 47 45]}; b = {[5 6 9 20 21],[7 85 14 2 3],[5 66 84 10 23 35 56],[5 6 87 14 21 29]}; for a{1} , possible combinations satisfy condition: {[2 6],[2 21],[3 6],[3 21],[2 6 21],[2 3 6],[2 3 21],[3 6 21],[2 3 6 21]} [2 3] contained in b{2} [6 21] contained in b{1} try this: c = cell(1, numel(a)); ii = 1:numel(a) aux = arrayfun(@(x) num2cell(nchoosek(a{ii}, x), 2)', 1:numel(a{ii}), 'un', 0); aux = [aux{:}]; c{ii} = aux(~cellfun(@(a) any(cellfun(@(b) all(ismember(a, b)), b)), aux)); end the result in c . run celldisp(c{1}) see result a{1} , example. this code takes every vector in a , find possible combinations using nchoosek . then, checks if combination has values contained on vector of b , returning remaining combinations ont in b , putting them c .

javascript - keep file order using jquery file upload -

i looking @ upload script here: http://demo.tutorialzine.com/2013/05/mini-ajax-file-upload-form/ it using jquery file upload upload multiple files @ once. know how pass order of files selected upload.php script. ie. if have 1.jpg, 2.jpg, 3.jpg, 4.jpg, , 4 finishes uploading first, can upload.php receive variable tells it 4th image selected? jquery file upload have way of adding order form action perhaps? thanks in advance. it should automatically upload , read data in order received once hits upload.php layer. make sure upload files in order want them.

javascript - Node.js singleton module pattern that requires external inputs -

normally might create simple singleton object node.js: var foo = {}; module.exports = foo; or function foo(){} module.exports = new foo(); however what best way make clean singleton module needs external variable initialization? end making this: var value = null; function init(val){ if(value === null){ value = val; } return value; } module.exports = init; this way using module can pass in initializing value variable. way so: function baz(value){ this.value = value; } var instance = null; module.exports = function init(value){ if(instance === null){ instance = new baz(value); } return instance; } there's 2 problems encounter this: (1) minor, semantics wrong. can rename init getinstance, can't make same function literal mean "initialize , get" since different meanings. have have function 2 different things. create instance , retrieve , instance. don't since in cases need make sure argument initialize instance not nul

laravel - How can I develop a package to use an earlier version of Guzzle than my app uses? -

i'm developing new package inside of existing laravel 5 app. plan on using package inside of app. want package depend on guzzle v4.2.3. app i'll use package in has dependency on aws sdk, pulling guzzle v6 app. how can make sure package uses earlier version of guzzle? possible? sorry -- you can't use 2 versions of single package composer . this makes sense due namespace collisions: // foo v3 namespace foo; class bar { // foo v4 namespace foo; class bar { there's no way composer autoloading in case, both versions use same namespace , class.

Why am I keep getting a java.lang.nullpointerexception in Android Studio? -

so trying pass text in 1 fragment main activity, , have main activity pass fragment can displayed. here code of fragment send main activity: public class topfragment extends fragment{ private static edittext topinput; private static edittext bottominput; fragmentinterface communicate; public interface fragmentinterface{ public void sendtheinput(string toptext,string bottomtext); } @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.top_fragment,container,false); topinput = (edittext) view.findviewbyid(r.id.topinput); bottominput = (edittext) view.findviewbyid(r.id.bottominput); final button submitbutton = (button)view.findviewbyid(r.id.submitbutton); submitbutton.setonclicklistener( new view.onclicklistener(){ public void onclick(view v){ buttonclicked(v); }

java - JPA Self Referencing Entities -

i have table called user this: public class user { private long userid; private string username; //other fields; } now lets user can have other user friends. how create relationship in jpa. meanwhile doing in user table in database: user_id username user_friends and in user entity this: public class user { private long userid; private string username; //other fields; @onetomany(cascade = cascadetype.all) @column(name = "user_friends") private list<userentity> friends; } this doesn't work. so, how achieve in jpa? in advance! after doing research , @florian schaetz, found solution self referencing entities. need user can have other user friends , user can friend other users. so, did this: public class user { private long userid; private string username; //other fields; @jointable(name = "user_friends", joincolumns = { @joincolumn(name = "adding_user", referencedco

logstash - Drop duplicate lines with NXLog -

i'm using nxlog read log file , send logstash. works fine, of log items duplicates. they're in separate lines, content same. can't change way logs written log file, way fix either nxlog before gets send, or in logstash when arrives, prefer not do. nxlog have function this, it's not working me. <processor norepeat> module pm_norepeat </processor> <route 1> path in => norepeat => out </route> after i'm still receiving duplicates in logstash. ideas? im_file populates raw_event should use this: checkfields raw_event see answer here .

java - How to update JTextfield after click SAVE button -

i have main frame : jframe>contentframe>scrollpane>bigpanel>panel_1t private jpanel contentpane; private jpanel bigpanel; private jpanel panel_1t; in panel_1t, have put food button actionlistener: jbutton button_19 = new jbutton("food"); button_19.addactionlistener(new actionlistener() { public void actionperformed(actionevent ae) { newfoodui nf = new newfoodui();//open other class nf.setvisible(true); nf.setdefaultcloseoperation(windowconstants.dispose_on_close); } }); panel_1t.setlayout(new gridlayout(0, 2, 0, 0)); panel_1t.add(button_19); when user click food button, new jframe in newfoodui class shown.: jframe>contentpane>panel>tabbedpane>panel_3>panel_5 in panel_5, put jtextfield: public static jtextfield textfield_3; textfield_3 = new jtextfield(); panel_5.add(textfield_3, "9, 4,

forms - symfony choice type should accept array of models -

i cannot find correct way pass array of 'models' choice type. expects 'norm' data, might code duplication many cases imho. duplicates code of model transformer $vehicles = $repo->findall(); $vehiclechoice = $builder ->create('vehicle', 'choice', [ 'choices' => \array_map( function(vehicle $v) { return $v->getid(); // same vehiclemodeltransformer::transform }, $vehicles), ]) ->addmodeltransformer( new vehiclemodeltransformer($this->em) ) ; vs. form should use model transformer initialize norm data $vehiclechoice = $builder ->create('vehicle', 'choice', [ 'choices_as_model' => $repo->findall(), // ]) ->addmodeltransformer( new vehiclemodeltransformer($this->em) ) ; anyone knows how write second w

how to order an svg visibility animation to toggle do one image after another -

i want make images included in svg file toggle on , off in order. need know how set begin , dur attributes on animate element. assuming have images following <image visibility="visible" xlink:href="image1.gif" x="0" y="0" height="100%" width="100%"> <animate attributename="visibility" begin="0s" from="visible" to="hidden" dur="5s" repeatcount="indefinite" /> </image> <image visibility="hidden" xlink:href="image2.gif" x="0" y="0" height="100%" width="100%"> <animate attributename="visibility" begin="5s" from="hidden" to="visible" dur="4s" repeatcount="indefinite" /> </image> how them toggle visibility in order, first image visible @ first 4 seconds, turns invisible next image visible 4 seconds, tur

javascript - Restrict overlays in mapbox -

so creating map using leaflet , mapbox multiple overlays , base maps. have layers control these separated , can show 1 base map @ time, overlays can shown @ once. however, have 2 overlays interfere each other , make if 1 checked in control, other unchecked , vice versa. there way this? i anticipating this, open suggestions. var layer1 = l.mapbox.tilelayer('mapid1'); var layer2 = l.mapbox.tilelayer('mapid2'); var layercontrol = l.control.layers(basemaps, {"l1": layer1, "l2": layer2}).addto(map); map.on("overlayadd", function(e) { if (e.name === "l1"){ l.layers.control.uncheck(layer2); } else if (e.name === "l2") { l.layers.control.uncheck(layer1); }; }); thank you!! working fiddle . i don't know if there's easier way. seems library doesn't offer many options manipulate l.control.layers overlays. what i'm doing firing click on conflicting overlay. achieve this, lit

glsl - Vertex Specification Best Practices using OpenGL (Windows) -

Image
i wonder best practice concerning cache management of vertices. actually, read numerous of articles on topic i'm not convinced yet best choice should use. i'm coding small 3d rendering engine , goal optimize rendering limiting number of draw calls , of course number of buffer bindings! until here, gather within single batch vertices of objects sharing same material properties (same lighting model properties , texture). if vbo reallocation fails (gl_out_of_memory), create new vbo store vertices of object. finally, attach each batch vao. pseudo-code: for_each vbo in vbo_list { vbo->bind(); for_each batch in vbo->getattachedbatchlist() { batch->bindvao(); { gldrawxxx(batch->getoffset(), batch->getlength()); } } } everything works technique use efficient 1 ? i took following article (opengl es - mac): https://developer.apple.com/library/ios/documentation/3ddrawing/conceptual/opengles_programm

Listening for new files Python -

i trying find solution problem have... have big share contains hundreds of thousands(if not millions) of files , new files arriving every second. trying write application make faster find files in share idea insert file names in redis db in format of : {'file_name','file_path'} , when file needed pull path db... problem starts when trying index old files(i assume take @ least few hours) while simeltaniously listen new files arrive during process. example of i'am trying do: import redis import os r = redis.strictredis(host='localhost',port=6379,db=0) root, dirs, files in os.walk(r'd:\\'): file in files: r.set(os.path.basename(file),os.path.join(root, file)) print 'the file %s succefuly added' %os.path.basename(file) how supposed modify code keep listening new files? thanks help!=) you should take @ watchdog library. you're looking for. here's example of using it: import sys import time impor

visual studio - Build Fails Missing File Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props -

Image
i have brand new visual studio 2015 project stored in tfs git repo. i've configured build using standard default git build template. new project builds locally fine, fails during tfs build following error: this project references nuget package(s) missing on computer. use nuget package restore download them. more information, see http://go.microsoft.com/fwlink/?linkid=322105. missing file ..\packages\microsoft.codedom.providers.dotnetcompilerplatform.1.0.0\build\microsoft.codedom.providers.dotnetcompilerplatform.props. when tfs first creates git repository, includes default .gitignore file "hides" files your (pending) changes window. 1 of wildcard based exclusions in default .gitignore file excludes files being checked in under folder includes "build/" includes specific file. now, i've commented out exclusion in file, , shows in (pending) changes window.

javascript - Using Angular's $q.all with codependent promises -

second promise needs result of first promise parameter. have seen example of solving problem es6 promises. firstthingasync() .then(function(result1) { return promise.all([promise.resolve(result1), secondthingasync(result1)]); }) .then(function(result1, result2) { // result1 , result2 }) .catch(function(err){ /* ... */ }); but not sure $q function has similar behavior promise.resolve. ideas? in angular 1.4 can use $q.resolve(result1) . source: angular 1.4 $q.resolve docs . in older versions can use $q.defer().resolve(result1) . source: angular 1.3 deferred api docs .

database - Azure Table Storage query for records based on property that may not exist for all records -

i using azure table storage service , trying introduce soft delete feature it. adding property ismarkedfordeletion entries marked deletion. when query, need entries not marked deletion. in fields not deleted, ismarkedfordeletion not exist. i have tried following: <...query...> , (ismarkedfordeletion ne true) <...query...> , (ismarkedfordeletion eq false) <...query...> , (not (ismarkedfordeletion ne false)) <...query...> , (not (ismarkedfordeletion eq true)) <...query...> , (not (ismarkedfordeletion eq null)) => returns 501 not implemented none of them showed entries did not have ismarkedfordeletion property in them. what do records not have ismarkedfordeletion records ismarkedfordeletion property exists, false? i have thought scrubbing database , adding ismarkedfordeletion records, or filtering results myself after query executed, in query easy me while creating segmented requests , paging results. i not think possible, try

vb.net - Exceptional handling in ASP.NET file handler -

i processing pdf/jpg/gif files using http handler. a popup receives btnid in query string , detects file extension calls handler btnid , processes request. files physical stored on server file names in db. when there issue file file not found or error want alert displayed , opened window closed not working right now. i know reason , writing alert response land in either object tag or image tag. can 1 please suggest how can achieved. appreciated. thanks!!! public class viewhelpcontent inherits system.web.ui.page 'method dynamically decides based on file extension file viewer render protected sub page_load(byval sender object, byval e system.eventargs) handles me.load dim embed string = string.empty dim count integer dim filename string = string.empty dim extension string = string.empty try if not ispostback if not request.querystring("btnid") nothing dim btn

c# - An error occurred while executing the command definition. See the inner exception for details in mvc 4 -

i getting following error on dropdownlist control: an error occurred while executing command definition. see inner exception details. here view code crashing on: @html.dropdownlist("packageid", null, htmlattributes: new { @class = "form-control" }) and here controller code data dropdownlist: viewbag.packageid = new selectlist(db.packages, "u_package_id", "package_nme"); and here package controller, in case needed: public class package { [key] public int u_package_id { get; set; } public string package_type_cd { get; set; } public string package_nme { get; set; } public string status { get; set; } public string modify_user_id { get; set;} public datetime modify_dt { get; set; } public string package_category { get; set; } public string i_package_nme { get; set; } public guid msrepl_tran_version { get; set; } public string invoice

c# - dnx . ef command returns System.Reflection.ReflectionTypeLoadException -

i'm trying create first migration file , got following error after execute dnx command: dnx . ef migration add migrationfile system.reflection.reflectiontypeloadexception: unable load 1 or more of requested types. retrieve loaderexceptions property more information. @ system.reflection.runtimemodule.gettypes(runtimemodule module) @ system.reflection.assembly.gettypes() @ microsoft.data.entity.commands.contexttool.getcontexttypes(assembly assembly) @ microsoft.data.entity.commands.migrationtool.getcontexttypes() @ microsoft.data.entity.commands.migrationtool.getcontexttype(string name) @ microsoft.data.entity.commands.migrationtool.addmigration(string migration name, string contexttypename, string startupassemblyname, string rootnamespace, string projectdir) @ microsoft.data.entity.commands.program.<>c__displayclass12_0.<addmigration>b__0() @ microsoft.data.entity.commands.program.execute(string startupproject, func`1 invoke) @ microso

Shibboleth header attributes not being sent to all pages -

i have following configuration in apache in service provider: <location /login > authtype shibboleth shibrequiresession on shibuseheaders on require valid-user </location> after authentication, tried access headers in page, did not exist. looks additional configuration required in apache. how configure shibboleth triggers @ /login , yet other pages have access headers? assuming using java fetch shibboleth parameters; shibboleth attributes can fetched ajp , have have ajp enabled in server. in shibboleth sp's shibboleth2.xml file's applicationdefaults tag add parameter - attributeprefix="ajp_" , send parameters ajp. in apache enable mod_proxy_ajp module , pass ajp via proxypass /my-application/login ajp://localhost:8009/my-application/login even if done, shibboleth parameters won't display directly under parameters.keyset() . if parameters.get(key) return value sent shib. above behaviour may vary different

Twilio REST API How to get Sid -

i still new twilio. writing php script connect twilio , parse information calls. using code page: https://www.twilio.com/docs/api/rest/call here code: require_once '../twilio-library/services/twilio.php'; // twilio rest api version $version = '2010-04-01'; // set our accountsid , authtoken $sid = 'abc132xxxxx'; $token = 'xxxxeeffv'; // instantiate new twilio rest client $client = new services_twilio($sid, $token, $version); // loop on list of calls , echo property each 1 foreach ($client->account->calls $call) { echo "->".$call->sid."<- <br/>"; } the browser outputs many blanks. no sid values. doing wrong? twilio developer evangelist here. try doing following call information. <?php require_once '../twilio-library/services/twilio.php'; // account sid , auth token twilio.com/user/account $sid = 'abc132xxxxx'; $token = 'xxxxeeffv'; $client = new serv

animation - Slide in/out JavaFX stage from/to right side of the screen -

i have task make javafx application. when start window should slides smoothly right side of screen , when click on "x" button it's should slides out right side , finishes. i found possible use simple timeline animation this. made window slide in, when run app, can't figure out how slide out window. i tried handle defining handler via setoncloserequest() method of stage, stuck 2 problems: can't implement animation after click on "x" application closed if use consume() method of window event code: public class main extends application { public static void main(string[] args) { application.launch(args); } @override public void start(stage stage) { stage.settitle("main"); group root = new group(); scene scene = new scene(root, 300, 250); stage.setscene(scene); rectangle2d primscreenbounds = screen.getprimary().getvisualbounds(); stage.setx(primscreenbounds.

WTL on Windows 10 -

has used wtl on windows 10 already? applications create wtl segfault on windows 10. work on windows 8 , windows 7. i tried basic hello-world application in wtl on windows 10 , segfaults when run it. there no clear indications of wrong. program segfaults generic windows segfault error. looks wtl isn't windows 10 compatible yet? has had problem yet. just asking here others have same problem. tried 2 different windows 10 (pre-release beta, , official release). i'm using latest wtl version wtl 9.0.4140 final (2014-05-30). all of our commercial applications wtl built in vs2008. work fine on windows 10. if can dmp file should able review crash dmp in windbg , see causing fault.

jquery - Hammer.js: clicking on SVG element to start javascript not working in iPhone Safari -

i'm trying make element in svg clickable in order call javascript function (in case alert function, can generic function). svg embedded in html page through object tag. svg <?xml version="1.0" encoding="utf-8"?> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="0 0 1024 768" enable-background="new 0 0 1024 768" xml:space="preserve"> <g id="livello_4"> <a xlink:href="javascript:alert('working!');" onclick="javascript:alert('working!');" target="_top"> <use xlink:href="javascript:alert('working!');"></use> <rect class="

php - cURL systematically times out when trying to connect -

i've installed curl.exe file indicated on many posts around here, updated path environment, tried many different tricks posted still, curl fails connect. typical error message is: c:\users\vcannilla>curl -v http://www.google.com rebuilt url to: http://www.google.com/ trying 64.233.184.104... connect 64.233.184.104 port 80 failed: timed out trying 64.233.184.147... connect 64.233.184.147 port 80 failed: timed out trying 64.233.184.106... connect 64.233.184.106 port 80 failed: timed out trying 64.233.184.99... connect 64.233.184.99 port 80 failed: timed out trying 64.233.184.103... connect 64.233.184.103 port 80 failed: timed out trying 64.233.184.105... connect 64.233.184.105 port 80 failed: timed out failed connect www.google.com port 80: timed out closing connection 0 curl: (7) failed connect www.google.com port 80: timed out some appreciated :) cheers

c# - WPF Menu Item doesn't get closed -

i want re-style contextmenu following style <controltemplate x:key="{x:static menuitem.submenuitemtemplatekey}" targettype="menuitem"> <border x:name="templateroot" borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" background="{templatebinding background}" height="22" snapstodevicepixels="true"> <grid> <button> <contentpresenter name="headerhost" contentsource="header" recognizesaccesskey="true"/> </button> </grid> </border> <controltemplate.triggers> <trigger property="ishighlighted" value="true"> <setter property="background" targetname="templa

How to retrieve max containers available from YARN in Hadoop Cluster? -

how total count i.e max capacity of containers resource manager of yarn in hadoop cluster. did try rest api's , jmx metrics getting total allocated containers , pending containers.so there way can retrieve max containers can created count? in yarn, have minimum allocation property, container have minimuum of value. based on can caluculate maximum number of containers can launched (divide total memory available yarn). think way maximum containers can launched. so in programs, these 2 properties , doing math required result. properties : <name>yarn.scheduler.minimum-allocation-mb</name> <value>1024</value> <name>yarn.scheduler.minimum-allocation-mb</name> <value>8192</value>

Latest version of Firefox won't start in Linux Mint -

since yesterday firefox won't start when click on icon. i'm running linux mint 14 in virtualbox. think it's trying update version 39.0.3. in terminal get firefox -safe-mode error: platform version '39.0.3' not compatible minversion >= 39.0 maxversion <= 39.0 there can (update configuration file?) make work? help

javascript - VB and Angular working toghether -

i'm working on project i'm making file editor. frontend love have in angular. so i've setup angular project loaded when going webform aspx page. but need load in document. happens via library , vb code (for authentication , on). , can see need pass data between javascript , vb side couple of times (like when users presses save , on). right vb part builds hughe html string , does: content.binary = system.text.encoding.default.getbytes(html) context.response.binarywrite(content.binary) context.response.flush() context.response.end() but think there more efficient way send data between two. i've found this: http://www.codeproject.com/articles/35373/vb-net-c-and-javascript-communication using webbrowser, , doesn't seem work on system.web.ui.page

html - Trying to get Nav menu and logo to align within the grid -

i working on responsive nav menu website. changed header image image slider on index.html page nav menu no longer aligned websites grid. in 'about', 'services' , contact pages menu positioned perfectly. in index.html page have css code position navbar , logo position:absolute; rest of navs on other page position relative. i want nav menus on each page align same there no obvious difference when user changes pages. may not obvious on small screens when compare index , pages on mobile device obvious nav not in correct grid. can point me in right direction? here link live site http://shaneogrady.me/navtest/ html <!doctype html> <html> <head> <title> hello </title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content="">&l

java - Hibernate @Any Annotation and Multiple Join Columns (ie: Composite Key) -

is possible use hibernate @any annotation when object being mapped has composite key? have tried following annotation combination: @any(metacolumn = @column(name = 'meta_column')) @anymetadef(idtype = 'string', metatype = 'string', metavalues = [ @metavalue(value = 'v1', targetentity = object1), @metavalue(value = 'v2', targetentity = object1), @metavalue(value = 'v3', targetentity = object2) ]) @joincolumns([ @joincolumn(name = 'column1'), @joincolumn(name = 'column2'), @joincolumn(name = 'column3') ]) unfortunately results in org.hibernate.mappingexception: property mapping has wrong number of columns: ca.package.class type: object

scala - Can I prevent "def" to be overriden with "val"? -

i have trait defines abstract method without parameters. want prevent implementors overriding val , method called every time value needed. eg. sealed trait downloader extends loader { def username: string def password: string def nonceprovider: nonceprovider def request: request def download = { val client = new client client execute request } } this trait used downloading resources. write following bad implementation: case class downloaderwithservicedefinition( override val username: string, override val password: string, override val nonceprovider: nonceprovider servicedefinition: servicedefinition) extends downloader { override val request = servicedefinitionrequest(servicedefinition, username, password, nonceprovider.generatenonce()) } in implementation, request assigned value during construction instead of behaving method, consecutive requests have same nonce value not intended. can prevent this? you not want general languag

How to use Phantomjs for opening a website in Selenium -

i'm trying use headless webkit of phantomjs opening google.com through selenium webdriver when execute code system throws error. phantomjs.exe placed in e directory. please me resolve issue. public static void main(string[] args) throws exception { desiredcapabilities caps = new desiredcapabilities(); caps.setjavascriptenabled(true); caps.setcapability(phantomjsdriverservice.phantomjs_executable_path_property, "e:\\phantomjs.exe"); webdriver driver = new phantomjsdriver(); driver.get("http://www.google.com"); } error: exception in thread "main" java.lang.illegalstateexception: path driver executable must set phantomjs.binary.path capability/system property/path variable; more information, see https://github.com/ariya/phantomjs/wiki . latest version can downloaded http://phantomjs.org/download.html @ com.google.common.base.preconditions.c

java - Update SQLite Database -

i have sqlite database set tutorial changing around own project: http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/ however tutorial not mention how update field.. have tried this: db = new notesdatabasehandler(viewnoteactivity.this); ... db.updatenote(new note(identifier, edittexttitle.gettext().tostring(), edittextcontent.gettext().tostring(), "updated on: " + printstandarddate())); although have had no luck.. run application , note not update. note class: package com.timmo.notes; class note { //private variables private int _id; private string _title; private string _content; private string _metadata; // empty constructor public note() { } // constructor public note(int id, string title, string content, string metadata) { this._id = id; this._title = title; this._content = content; this._metadata = metadata; } public int getid() { return this._id; } public void setid(int id) { this._id = id; } public string g

Python Dict List to Sum of ints -

so have series of lists i'd sum on , return each individual value of. lists this: 'testrel.txt': [1, 1, 1, 1, 1] this recent traceback: traceback (most recent call last): file "./seriescount.py", line 24, in <module> w.writerow(sum(series)) typeerror: unsupported operand type(s) +: 'int' , 'str' i know why won't sum values (they're not integers , therefore can't summed), i'm having trouble syntax of casting list of key values ints. here's script: #!/usr/bin/env python import csv import copy import os import sys import glob #get current working dir, set count, , select file delimiter os.chdir('/mypath') #parses through files , saves dict series = {} fn in glob.glob('*.txt'): open(fn) f: series[fn] = [1 line in f if line.strip() , not line.startswith('#')] print series #save dictionary key/val pairs csv open('seriescount.csv', 'wb') f: w = csv.dictwri

c# - HttpClient calling a Windows-Authenication ApiController Method...but no WindowsIdentity coming along for the ride -

is there way api controller iidentity of account initiated call api controller when api-controller using windows-authentication ? my "castcontroller.user.identity" (of type) windowsidentity. "empty". empty, : isauthenticated = false, , empty username. isn't null, "empty". my "webtier" iis application running custom apppool , iidentity runs custom apppool "mydomain\myserviceaccount". i'm trying "castcontroller.user.identity.name" value service account. (i guess client able connect webapitier valid windows-account, i'm mentioning in case throwing weird monkey wrench) my "webtier" (mvc application) has method: you'll notice 2 ways i'm using usedefaultcredentials. (aka, i've been trying figure out bit) private async task<httpresponsemessage> executeproxy(string url) { httpclienthandler handler = new httpclienthandler() { used