Posts

Showing posts from August, 2015

cygwin - Octave cannot plot: cygoctave-1.dll loaded to different address -

i trying use octave in win 7, 64 bit. installed cygwin64, octave, gnuplot , x11. however, when start x server , opened octave, trying plot, came this: octave:1> plot(1:10) 0 [main] octave-3.6.4 5560 child_info_fork::abort: c:\cygwin64\bin\cygoctave-1.dll: loaded different address: parent(0xf30000) != child(0xe90000) error: popen2: process creation failed -- resource temporarily unavailable error: called from: error: /usr/share/octave/3.6.4/m/plot/private/__gnuplot_open_stream__.m @ line 30, column 44 error: /usr/share/octave/3.6.4/m/plot/__gnuplot_drawnow__.m @ line 72, column 19 would please little bit here? thank you! -shawn got solved. got answer cygwin mailing list, follows: the problem is, hash algorithm used ld compute default dll load address not bullet proof, not such big address space have available dlls. still requires run rebase on safe side. however, found problem in 64 distro results in not running autorebase part of upda

sentiment analysis - What exactly is an n Gram? -

i found previous question on so: n-grams: explanation + 2 applications . op gave example , asked if correct: sentence: "i live in ny." word level bigrams (2 n): "# i', "i live", "live in", "in ny", 'ny #' character level bigrams (2 n): "#i", "i#", "#l", "li", "iv", "ve", "e#", "#i", "in", "n#", "#n", "ny", "y#" when have array of n-gram-parts, drop duplicate ones , add counter each part giving frequency: word level bigrams: [1, 1, 1, 1, 1] character level bigrams: [2, 1, 1, ...] someone in answer section confirmed correct, unfortunately i'm bit lost beyond didn't understand else said! i'm using lingpipe , following tutorial stated should choose value between 7 , 12 - without stating why. what ngram value , how should take account when using tool lingpipe? edit: tutorial: http

vb.net - shadows an overridable method in the base class -

i'm on new project , there's lot of warning: function 'yyy' shadows overridable method in base class 'zzz'. override base method, method must declared 'overrides'. i'm wondering if it's safe put overrides. default behavior? there lot of testing done , want minimize problems. changing overrides not same. can add keyword shadows eliminate warning, if have run long time message, changing them override may cause things work differently before. the difference between overrides , shadows shadows not have polymorphic effect overrides does, if call method on base class object, if happens holding child class instance, base class method called. but again, if getting warning, means adding shadows keyword you, throws warning make sure effect want, can eliminate adding keyword yourself. if suspect overrides behavior wanted, can add well, realize not equivalent.

javascript - How to insert html in to svg element -

element formed if there exists within thehave markup <g id="g-svg_el_obj921" style="top: 300px; left: 550px;"> <circle r="95.12" fill="rgb(50, 149, 196)" class="some_class" id="svg_el_obj921" priority="4" position="300_550" cx="550" cy="300"></circle> </g> i need insert div element g or circle element, this: $('g').each(function(){ var feel_el = document.createelementns('http://www.w3.org/1999/xhtml', 'div'); var $feel_el = $(feel_el); $(this).append($feel_el); }); element formed seems not exist... can help? all foreign content must child of <foreignobject> element in svg. additionally <circle> element can't have rendered children, <g> element can. so you'd have change function firstly creates <foreignobject> element, gives element width , height , creates <d

c# - Cannot apply indexing with [] to an expression of type 'System.Collections.Specialized.NameValueCollection' -

Image
i've tried under sun access appsettings , cannot work. i've got class library needs access web appsettings. i've checked , there no 'system.collections.specialized.namevaluecollection' import. anyone got ideas? using system; using system.collections.generic; using system.configuration; using system.linq; using system.net.http; using system.text; using system.threading.tasks; using system.web; using system.web.configuration; public static class httpresponsebase_setoauthfromcookie { public static void setoauthfromcookie(this httpresponsebase response, string verify, string token, string tokensecret, string username, bool istwitter) { string pas = webconfigurationmanager.appsettings["cryptpass"], crypt = ((verify.length > 3 ? (verify + ":") : "twit") + token + ":

Spring Integration: Routing messages by content -

using spring integration: when message received should go 1 of 4 different channels based on attribute in message. if specific field in message begins a-f should go channel 1, g-m channel 2, etc. what efficient way this? if can visually represented in sts designer, big plus. lot as discussed in answes same question on spring forum , efficient pojo router <router ... ref="myrouter" .../> where pojo return reference messagechannel or channel name. but integration graph won't connect router channels. you can use <recipient-list-router/> selector expressions; show nicely in sts, less efficient because expressions evaluated.

python - Create Column with ELIF in Pandas -

question i having trouble figuring out how create new dataframe column based on values in 2 other columns. need use if/elif/else logic. of documentation , examples have found show if/else logic. here sample of trying do: code df['combo'] = 'mobile' if (df['mobile'] == 'mobile') elif (df['tablet'] =='tablet') 'tablet' else 'other') i open using where() also. having trouble finding right syntax. in cases have multiple branching statements it's best create function accepts row , apply along axis=1 . faster iteration through rows. def func(row): if row['mobile'] == 'mobile': return 'mobile' elif row['tablet'] =='tablet': return 'tablet' else: return 'other' df['combo'] = df.apply(func, axis=1)

javascript - scope of `this` changing on a production server? -

i have following 3 functions in backbone view. originally, call updatetimer within playback , startrecording functions triggered error, went away after preceded call this , in this.updatetimer . however, i've put demo app on production server (where code compiled 1 file) , call this.updatetimer triggering error uncaught typeerror: object #<object> has no method 'updatetimer' (repeated 28 times) can explain why might be? the 3 functions working on local machine: playback: function(e){ e.preventdefault(); this.updatetimer(0); sc.recordplay({ progress: function(ms) { this.updatetimer(ms); } }); }, updatetimer: function(ms){ $('.status').text(sc.helper.millisecondstohms(ms)); }, startrecording: function(e){ $('#startrecording').hide(); $('#stoprecording').show(); e.preventdefault();

swing - How to properly dispose graphics context - do I need try and finally? (Java 1.7) -

how dispose graphics context - need use try , finally ? simple example: public void paint(graphics g) { graphics2d g2d = (graphics2d) g.create(); try { g2d.drawline(0, 0, 10, 0); } { g2d.dispose(); } } edit this example java.awt.window class: /** * {@inheritdoc} * * @since 1.7 */ @override public void paint(graphics g) { if (!isopaque()) { graphics gg = g.create(); try { if (gg instanceof graphics2d) { gg.setcolor(getbackground()); ((graphics2d)gg).setcomposite(alphacomposite.getinstance(alphacomposite.src)); gg.fillrect(0, 0, getwidth(), getheight()); } } { gg.dispose(); } } super.paint(g); } as see, constructors used pretty simple, try , finally still exits. think practice use them. in simple example, there&#

mysql - PHP DOMDocument won't parse XML string as UTF-8 -

i'm trying parse xml-formatted string domdocument. following code: mysql_connect("localhost", "myusername", "mypassword") or die(mysql_error()); mysql_select_db("cmj_db") or die(mysql_error()); $data = mysql_query("select article_id, html_data articles article_id=".$_get["article_id"]) or die(mysql_error()); $dataarray = mysql_fetch_array($data); echo 'article: ' . $dataarray['article_id'] . '<br />'; $doc = new domdocument; $doc->loadxml(encoding::toutf8($dataarray['html_data'])); i error: warning: domdocument::loadxml(): input not proper utf-8, indicate encoding ! bytes: 0x96 0x20 0x6e 0x6f there special characters involved, require utf encoding. when echo string on own, characters fine. might helpful note has been long succession of conversions.. unescaped lot of characters html encoding, , imported mysql table (with utf-9 charset). how can convert string unicode can

java - When are curly braces not required for multi-line loop bodies? -

why code behave correctly? i've been told multi-line loop bodies should have curly braces public class sample { public static void main(string[] args) { int[] nums = {1,2,3,4,5,6,7,8,9,10}; // print out whether each number // odd or (int num = 0; num < 10; num++) if (num % 2 == 0) system.out.println(num + " even"); else system.out.println(num + " odd"); } } the trick here difference between statement , line . loop bodies execute next statement , unless there curly braces, in case loop execute whole block inside curly braces. (as mentioned in other answers, always practice use curly braces every loop , if statement. makes code easier understand, , easier correctly modify.) to specific example: an if-else statement in java considered single statement. in addition, following valid single-line statement: if(someboolean) someaction(1

c# - Substring with repeating character -

how substring sample combobox items e11-143 - america --> america jc - political theory --> political theory i tried this: string test = combobox1.text.substring(combobox1.text.indexof('-') + 1).trim(); but result e11-143 - america --> 143 - america jc - political theory --> political theory use lastindexof index of last occurrence of character: string test = combobox1.text.substring(combobox1.text.lastindexof('-') + 1).trim();

reporting services - Change format of column in SSRS during export -

i have date columns in ssrs that, when our internal users view/review data, need shown in usual mm/dd/yyyy format. users dump report excel. in export, need convert date string , format yyyymmdd. is possible change output format of column during export? edit: (based on comments below) i love phrase "almost exactly" :) the other question mentioned below asking why dates appear way in excel after exporting wanted change format before or export happened. question had nothing regional settings question referred below mentions. what needed date show on report (at report server, on-screen) 8/13/2013, let's say, when export excel needed format of 20130813. to helpful read this, adding parameter report header, allowing user change selection run report in 2 separate "modes" worked me. what did add reportmode param, give 2 values, modea , modeb. defaulted param dropdown modea. in date column, checked how param set , changed format of date, through exp

python - When does a module scope variable reference get released by the interpreter? -

i'm trying implement clean-up routine in utility module have. in looking around solutions problem, settled on using weakref callback cleanup. however, i'm concerned won't work expected because of strong reference object within same module. illustrate: foo_lib.py class foo(object): _refs = {} def __init__(self, x): self.x = x self._weak_self = weakref.ref(self, foo._clean) foo._refs[self._weak_self] = x @classmethod def _clean(cls, ref): print 'cleaned %s' % cls._refs[ref] foo = foo() other classes reference foo_lib.foo . did find old document 1.5.1 sort of references concerns ( http://www.python.org/doc/essays/cleanup/ ) nothing makes me comfortable foo released in such way callback triggered reliably. can point me towards docs clear question me? the right thing here explicitly release strong reference @ point, rather counting on shutdown it. in particular, if module released, globals

java - nullPointerException in multiarray -

i making realm plugin server, , using multiarray detect location of users portals, below code: public static string[][][] realms; @eventhandler public void onplayerinteract(final playerinteractevent event) throws exception { if( event.getmaterial() == material.nether_star ) { int x = (int) event.getclickedblock().getx(); int y = (int) event.getclickedblock().gety(); int z = (int) event.getclickedblock().getz(); ** realms[x][y][z] = event.getplayer().getname(); createportal(); } } i nullpointerexception @ line '**', can please explain doing wrong? have googled 'java multiarrays', , seem work same way. you getting null pointer exception because haven't initialized array. you can initialize array this: string string[][][] = new string[3][3][3]; you need know length of arrays, because if try access or save value index doesn't exists going indexarrayoutofbounds exception

python dict, find value closest to x -

say have dict : d = {'a': 8.25, 'c': 2.87, 'b': 1.28, 'e': 12.49} and have value v = 3.19 i want : x = "the key value closest v" which result in x = 'c' any hints on how approach this? use min(iter, key=...) target = 3.19 key, value = min(dict.items(), key=lambda (_, v): abs(v - target))

c++ - Boost::tuple - assigning to get<>() -

the following fails compile on assignment t.get<1>(). struct pull_from_memory { pull_from_memory(memorybank &m) : m_map(m) {}; void operator()(boost::tuple<string&, string&> &t ) { memorybank::iterator i; if ( ( = m_map.find(t.get<0>())) != m_map.end() ) { t.get<1>() = *i; // compilation error } } private: memorybank &m_map; }; the error message, fwiw, is: tom.cpp: in member function 'void pull_from_memory::operator()(boost::tuples::tuple<std::string&, std::string&, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>&)': tom.cpp:424: error: no match 'operator=' in '((boost::tuples::tuple<std::string&, std::string&, boost::tuples::null_type, boost::tuples::null_type, boost::tuple

WSO2 api manager specify mandatory parameter in URL pattern -

does know how use wso2 api manager specify mandatory parameter through url pattern. example, have api registered in wso2 api manager , , uri '/abc/search/?a="xx"&b="yy"', both of these 2 query parameters (a & b) optional. want make 'a' mandatory one, don't want change api logic, there anyway resolve using wso2 api manager? in url pattern, tried '/{a}', '/?a={a}' , /{?a} before, of them did not work from apimanager use urlmapping. can is, open api configurtaion, can found in am_home\repository\deployment\server\synapse-configs\default\api folder , edit url-mapping part url template. eg: url-mapping="/*" uri-template="/{string1}/{string2}"

django - python german umlaut issues - 'ascii' codec can't decode byte 0xe4 in position 15: ordinal not in range(128) -

i reading csv file , saving data model. with open(settings.media_root + '\\f.csv', 'rb') f: reader = csv.reader(f,delimiter=';') row in reader: uname = u"'" + row[2]+"'".encode('utf-8') u = university(name=uname) u.save() and have word in file: westfälisch . word code gets stuck. this error message: 'ascii' codec can't decode byte 0xe4 in position 15: ordinal not in range(128) string not encoded/decoded was: westf�lisch what doing wrong? please help. uname = ("'" + row[2]+"'").decode('utf-8') # need

sql - Oracle output in sqlplus -

i have oracle stored procedure has output users in form of dbms_output.put_line('....'); i run stored procedure through .sql file in sqlplus , none of output messages of stored procedures being shown in sqlplus command window. how outputs show in command window? thanks, you need set server output on command: set serveroutput on; cheers!

python - Django QueryDict empty with request.POST but populated in request.GET -

short version : on django site, can grab values request.get not request.post in response request twilio. suspect has csrf, i'm not sure how debug problem. details below. long version: helping friend project running medical survey on sms using twilio rest api. had domain , bare-bones django-built site on domain, had built better familiarize myself django, we're using that. we're collecting sms responses our survey , part of twilio api, sends response our number url specified under account, have response targeting following: ...mydomain.com/some_page/another_page/ the twilio request looks following: ...mydomain.com/some_page/another_page/?accountsid=###some_long_account_side&from=%2bphone_number&body=bla+bla+bla+bla&smssid=##message_id_key&smsmessagesid=##message_id_key&fromcity=santa+cruz&fromstate=california... working code i testing incoming request has our accountsid inside (compared value in database) , in views.py app, h

facebook - Graph API search for user broken since Q3 2013 migration -

does know if graph api search user email address available since q3 2013 migration went effect on july 10, 2013? i know searching applications removed, , notes application access token required search other places , pages, can't seem search work type=user @ anymore. i used able fetch data url similar to: https://graph.facebook.com/search?q=email_address&type=user&access_token=valid_user_access_token relevant documentation have found: https:// developers.facebook.com/docs/reference/api/search/ https:// developers.facebook.com/blog/post/2013/04/03/platform-updates--operation-developer-love/ following note: "graph api search changes app access tokens required search graph api calls except places , pages. search application no longer supported." i've tried using app access_token in url directly using php sdk, following exception back: { "error": { "message": "(#200) must have valid access_token access endpoint&

javascript - How to register event handlers for TypeScript declarations -

i've asked question on typescript's codeplex forums didn't answer i'm asking here. given typescript class declaration, example bing maps 1 ( https://bingmapsts.codeplex.com/ ) how register event handler? on map class (in microsoft.maps.d.ts) there couple of events declared: viewchange: () => any; viewchangeend: () => any; viewchangestart: () => any; and i've tried hooking function following inside typescript file never gets called: ///<reference path="bing/microsoft.maps.all.d.ts" /> window.onload = function() { var map = new microsoft.maps.map(document.getelementbyid('map'), { backgroundcolor: 0, }); map.click = () => alert('click'); map.viewchangestart = () => alert('viewchangestart'); } in traditional javascript, use following: microsoft.maps.events.addhandler(map, 'viewchangestart', function (e) { alert('viewcha

php - Laravel: Addition to an existing field data in a column -

please how express php mysql update code in eloquent mysql_query("update `some_table` set `value` = `value` + 1000 `id` = 1"); or mysql_query("update `some_table` set `value` = `value` + $formdata `id` = 1"); you can retrieve model , increment it: $model = some_model::find( $id ); $model->value += 1000; $model->save();

javascript - Function almost complete - Need to make it close -

what missing? trying make function close, have working opening, can't figure out how make close using same code applies open... javascript: $(document).ready(function(){ $('a.head').click( function(){ var = $(this) ; var section = $( a.attr('href') ); section.removeclass('section'); $('.section').hide(); section.addclass('section'); if(! section.is(':visible') ){ section.fadein(400); }; }); }); edit: $(document).ready(function(){ $('a.head').click( function(){ var = $(this) ; var section = $( a.attr('href') ); section.removeclass('section'); $('.section').hide(); section.addclass('section'); if(! section.is(':visible') ){ section.fadein(400); }; else(! section.is(':visible') ){ section.fadeout(400); };

excel - How to insert column name in the destination table in ssis? -

!reference question 1 as shown in image... have excel sheet, contains 32 tables 1 after other (i have taken 2 tables in image) may grow table count... metadata same tables.table has 2 columns 1 constant(name) & 1 change(tpa,tpb.. etc) there no change in column position. problem how hold header , inserted t_type value destination table ? the no of rows in each table not fixed( can't go cell reference). the problem understand it i believe have data in excel looks approximately name | tpa abc | x ... name | tpb acz | p the data described blocks of data. block defined bounded starting row value of name in it. next cell on row contain value applies subsequent rows. after header row, need pull out key value pairs , write them plus table name destination. the meta data remains consistent, it's source data banjaxed. resolution this problem had overcome when wrote ssis excel source via ssis . had source our data feeds reports instead of clean tabul

python - Coerce in django forms -

what coerce argument in django forms? i've read documentation, not helpful, explanation few examples of use cases helpful. quote documentation: a function takes 1 argument , returns coerced value. examples include built-in int, float, bool , other types. defaults identity function. typedchoicefield choicefield, except choicefield return unicode. with typedchoicefield pass function takes 1 argument , returns value cast type want. example, if want coerce value integer, use: int_field = forms.typedchoicefield(choices=some_choices, coerce=int) the field value integer or fail validation.

download - PHPExcel how to zip -

i can't find example show how zip xlsx file. idea want create few xlsx files , zip , force archive downloaded. if write example. best if xlsx or zip files wouldnt stay @ server disc. great if on fly creating files->zipping->download. to save 1 xlsx file im doing this: header('content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('content-disposition: attachment;filename="user&host_'.date('d-m-y').'.xlsx"'); header('cache-control: max-age=0'); $objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007'); $objwriter->save('php://output');

java - Camel process do not shutdown because of (not existing) inflight exchanges -

i've camel process (that run command line) route similar one: public class profilerroute extends routebuilder { @override public void configure() { from("kestrel://my_queue?concurrentconsumers=10&waittimems=500") .unmarshal().json(jsonlibrary.jackson, myclass.class) .process(new processor() { @override public void process(exchange exchange) throws exception { /* real processing [...] */ exchange.getin().setbody(null); } }) .filter(body().isnotnull()) .to("file://nowhere"); } } note i'm trashing whatever message after having processed it, being pure consumer process. the process run own. no other process writing on queue, queue empty. when try kill process process not going die. from logs see following lines (indented readability): [ thread-1] mainsupport$hangupinterceptor info

Naming convention in Java libraries and projects -

the suggestion creating java library eclipse helpful. created library project, exported jar file, , added build path of couple of clients. what names better if each library may used several clients , vice versa? for instance. for projects. com.rp.project1 com.rp.project2 com.rp.project3 and on. for libraries. com.rp.lib1 com.rp.lib2 com.rp.lib3 and on. is practice? well there no naming conventions libraries , projects. allowed call them like. important use right names packages. should unique! example use email address. you quick overview of naming conventions here . possible duplicated many times!

javascript - Ember.js setupController fired only once -

suppose have view: cellarrails.searchtextfield = ember.textfield.extend({ templatename: 'index', insertnewline: function(){ this.get('controller').set('query', this.get('value')); // calling search method of application controller this.get('controller').send('search'); this.set('value', ''); } }); and applicationcontroller : cellarrails.applicationcontroller = ember.controller.extend({ needs: ['search'], query: '', // here search method search: function() { // i'm using ember-query lib, provides helper, acts usual transitiontoroute this.transitiontoroutewithparams('search', { q: this.get('computedquery') }); }, computedquery: function() { this.get('controllers.search').set('q', this.get('query')); return this.get('query'); }.property('query') }); so should transitioned sea

osx - Compiling Mesa for Mac OS X 10.8 for an unsupported GPU -

is possible compile mesa mountain lion. intel hd graphics 2000 mobile unsupported, , opengl acceleration doesn't work if move driver (kext) /system/library/extensions/ i'm stuck on grey screen. i'm thinking of using mesa instead of mac os x built-in opengl. possible compile somehow? opengl integrated macos x, hence it's virtually impossible upgrade or change opengl driver without actual os upgrade. technically it's possible compile mesa software renderer, performance not great; there's no nsopenglview replacement mesa, involve using hackish. what kind of hardware trying run this? actual macbook or attempting run hackintosh, i.e. macos x on non-apple hw?

ember.js - List all available Handlebar Templates in the JavaScript console -

how can list available handlebar templates names in javascript console? try using ember.keys : ember.keys(ember.templates); hope helps.

php - Automated form submission to an external script -

got question , i'm not sure it, thought i'd ask. one of pages on server contains ordinary html form, designed contact external script form submission. if open page, enter information in fields manually, , hit "process", external script will, naturally, record own ip address visitor. what ip address record if automate form submission using server-side method, such curl? record server's ip address, since server sending automated request script, or record client's ip address, usual? if rely on $_server["remote_addr"] , record address sees in request, depends on how routing on server set up. if you're sending request localhost - record localhost (127.0.0.1) rather server`s external ip even. if request originates visitor surfing web, have multiple options of keeping track: use standard x-forwarded-for header in sub-request , track track proxied request. (check if $_server["http_x_forwarded_for"] passed , use real ad

javascript - parent.alert event not getting fire on pressing enter key -

i have main jsp page in alert functionality modified using window.alert=function(txt) in other jsp pages loaded in same document using iframe. parent.alert used in of these pages keep consistency. this piece of code working with <div onkeypress="handlekey()"> <button id='done' onclick="example()" >submit</button> </div> script portion following <script> function handlekey(){ if ((window.event) && (window.event.keycode == 13)) { // click search button done.click(); } } function example(){ parent.alert('done'); } </script> alert not fired if press enter key fired when click on button. alert gets fired when replace parent.alert alert. this works fine me: index.html <html> <head> <script> window.alert = function(){ console.log('my alert'); } </script>

asp.net - Passing parameter to telerik popup -

is there way pass parameter telerik similar window.showmodaldialog the way call window.showmodaldialog : window.showmodaldialog(pagename, myargs, 'status:no;dialoghide=true;help:no') myargs parameter passing popup try likes , <script type="text/javascript"> function openradwin(myargs) { radopen("yourpagename.aspx?parameter=" + myargs , "radwindow1"); } </script> <telerik:radwindowmanager id="radwindowmanager1" runat="server" enableshadow="true" visiblestatusbar="false"> <windows> <telerik:radwindow id="radwindow1" runat="server" showcontentduringload="false" width="400px" height="400px" title="telerik radwindow" behaviors="default"> </telerik:radwindow> </windows> </telerik:radwindowmanager> and , @ page_load of

Adding new lines in HTML -

so i'm trying add text inside variable , variable together. every time add new text want added on line. when it's spread on multiple lines instead of being on 1 line. here code have far. how put old sresults on lower lines? sresults = ("you boss" + sresults) i've tried using <p> in don't think i'm implementing right. tried using \n in as3 that's not working , <tr> tables i'm still pretty new html , have no idea. if using javascript try way : sresults = ("you boss" + sresults) sresult=sresult+"<br>";

pyro - Python Pyro4, client dosent see name server which is created in server file -

i try create name server in server file pyro4.naming.startns() method. my server file looks this: my_object = myclass() daemon = pyro4.daemon() uri_deamon, ns, br = pyro4.naming.startns() uri = daemon.register(my_object) ns.nameserver.register("server", uri) daemon.requestloop() and client: ns = pyro4.locatens() uri = ns.lookup('server') my_object=pyro4.proxy(uri) pyro4.locatens() never ends. after start server file. try execute "python -m pyro4.nsc list" , command never ends too. have ideas wrong? tomek. solution: i needed use pyro4.naming.startnsloop() instead of pyro4.naming.startns(). pyro4.naming.startnsloop should executed in thread.

ios - How can I get the height of a specific row in my UITableView -

in uitableview i've set different heights different rows using delegate method: tableview:heightforrowatindexpath: now given nsindexpath , height i've assigned specific row. you can use this cgrect frame = [tableview rectforrowatindexpath:indexpath]; nslog(@"row height : %f", frame.size.height); using frame.size.height can height of particular row swift 3 let frame = tableview.rectforrow(at: indexpath) print(frame.size.height)

Java get xml elements value using xpath "And" -

this question has answer here: xpath multiple conditions 3 answers my question follows: i'm using xpath values need in xml. how value has 2 conditions ? e.g. book[uim_level_type='aaa'] , [uim_sub_rec_type='bbb']- doesn't work.. whats the correct way write it? what's wrong book[uim_level_type='aaa' , uim_sub_rec_type='bbb'] ? or, matter, book[uim_level_type='aaa'][uim_sub_rec_type='bbb']

jquery - Ignore validations on few fields according to another field -

i use jquery validation engine validate following form. static <input type="radio" name="mode" value="static" data-validation-engine="validate[required] radio" data-prompt-position="topright:-70"/> dhcp <input type="radio" name="mode" value="dhcp" data-validation-engine="validate[required] radio" data-prompt-position="topright:-70"/> ip <input type="text" name="ip" id="ip" data-validation-engine="validate[required,custom[ipv4]]" data-prompt-position="topright:-70"/> gateway <input type="text" name="gateway" id="gateway" data-validation-engine="validate[required,custom[ipv4]]" data-prompt-position="topright:-70"/> dns <input type="text" name="dns" id="dns" data-validation-engine="validate[required,custom[ipv4]]" d

python - Concurrent writing with sqlite3 -

this question has answer here: sqlite3 concurrent access 4 answers i'm using sqlite3 python module write results batch jobs common .db file. chose sqlite because multiple processes may try write @ same time, , understand sqlite should handel well. i'm unsure of happens when multiple processes finish , try write @ same time. if several processes this conn = connect('test.db') conn: v in xrange(10): tup = (str(v), v) conn.execute("insert sometable values (?,?)", tup) execute @ once, throw exception? wait politely other processes write? there better way this? the sqlite library lock database per process when writing database , each process wait lock released turn. the database doesn't need written until commit time however. using connection context manager (good!) commit takes place after loop has

multithreading - Marshalling call to main thread from System.Timers.Timer -

i have tough question (for me @ least). i'm working on windows service written in vb.net. i'm using system.timers.timer class periodically call delegate method see if there work do. timing of processing not critical , have attempted prevent re-entry worker method disabling timer method invoked , starting again @ end. however, timer class elapsed events occur on different thread. searching online, people using windows forms implement isynchronize interface marshal call originating thread. ideally don't want use windows forms achieve this. there easy way re-direct call original thread? alternatively there framework class can inherit this? or @ worst simple implementation of isynchronize? imports system.timers imports system.io imports system.data public class application implements idisposable private withevents _timer timer private sub sleeptimercallback(sender object, e elapsedeventargs) handles _timer.elapsed ' todo need find way bring

c# - Thinktecture - Unable to handle an encrypted SAML security token in Web API -

in .net web api, how can configure thinktechture saml2securitytokenhandler use x509 certificate handle encrypted saml2 security token (decrypt before validating). the token encrypted identity server configuring rp use certificate encrypting. below working configuration (without handling encrypted token) taken thinktechture samples: #region identityserver saml authentication.addsaml2( issuerthumbprint: constants.idsrv.signingcertthumbprint, issuername: constants.idsrv.issueruri, audienceuri: constants.realm, certificatevalidator: x509certificatevalidator.none, options: authenticationoptions.forauthorizationheader(constants.idsrv.samlscheme), scheme: authenticationscheme.schemeonly(constants.idsrv.samlscheme)); #endregion to enable encrypted tokens web api, found helpful: http://www.alexthissen.nl/blogs/main/archive/2011/07/18/using-active-profile-for.aspx towards e

Reference javascript object in its variables when declaring it -

i have object defined this: function company(announcementid, callback){ this.url = 'https://poit.bolagsverket.se/poit/publiksokkungorelse.do?method=presenterakungorelse&diarienummer_presentera='+announcementid; self = gm_xmlhttprequest({ method: "get", url: this.url, onload: function(data) { self.data = data; callback(); } }) } on callback, wish reference method object called "callbacktest", i'm trying this? var mycompany = new company(announcementid, callbacktest); if anonymous function, have written mycompany.callbacktest() how reference "mycompany" within variables? until reference returned constructor mycompany , can't access argument. so, " anonymous function " alluded way accomplish have access variable, have reference: var mycompany = new company(announcementid, function () { mycompany.callbacktest(); }); or, maybe

Groovy configuration for logback based on hostname -

i trying configure logback dynamically using hostname setup specific property logger. initialize map following, before appender: def hostname="${hostname}" def logentriestokens = [ "info03": "mytoken" ] and following: appender("logentriesappender",logentriesappender){ encoder(patternlayoutencoder) { pattern = "%d{dd mmm yyyy ; hh:mm:ss.sss} [%thread] %-5level %logger{36} - %msg%n" } token = logentriestokens[hostname] println hostname println logentriestoken println logentriestokens[hostname] println token ssl = false facility = "user" filter(thresholdfilter){ level = error } } and result following: info03 [info03:mytoken] mytoken null for reason, token property not set (i can see investigating appenders hierarchy in java). if instead put constant , such token = "mytoken", works fine. wrong?

xml - OpenERP - Compare fields using external id? -

is possible compare fields in views using external id (not internal one). need because need hide fields depending on fields. can make work using internal database id. if user chooses example country (in view checks countries id), if id matches in view compared, shows field. example this: <field name="some_field" attrs="{'invisible': [('country_id','!=',10)]}" /> this 1 works, not reliable. imagine if id change (for example installing module id taken other country), show some_field when different country chosen. , not intended. thought using external id, provide when adding data tables in xml files. id static , should same database install module (because id provided in module itself, not created database automatically). there way use same feature, using external id? of course maybe knows better approach solve such problem? p.s. adding field boolean show hide some_field not option, because depends entirely on specific va

ruby on rails 3 - Heroku + SendGrid + ActionMailer - Errno::ECONNREFUSED (Connection refused - connect(2)) -

gem 'rails', '3.2.12' gem "devise", "~> 2.2.4" ruby : ruby 1.9.3dev (2011-09-23 revision 33323) [i686-linux] i tried every possible alternative/combination find on web facing unable rid of error: errno::econnrefused (connection refused - connect(2)) on heroku. i used sendgrid credentials on development environment , working , mails delivered successfully.however on heroku facing error. i able telnet smtp.sendgrid.net @ port 587 25. please find config/code snippets below have in place. /config/settings.yml app_name: 'demoapp' default_host: <%= env['default_host'] %> # mail settings. mail: address: <%= env['mail_address'] %> port: <%= env['mail_port'] %> domain: <%= env['mail_domain'] %> user_name: <%= env['mail_user_name'] %> password: <%= env['mail_password'] %> /config