Posts

Showing posts from May, 2014

c++ - initiating class as a member of struct -

im trying create struct class member inside: .h file: class { public: struct result { int x; ugraph g; <------ class definition }; result m_tempstructresult; a:a(void); void function(); } .cpp file a::a() { } void a::function() { ugraph graph(10); <---- object has receive value ... //manipulations on graph ... m_tempstructresult.g = graph; } the compilation error is: error c2512: 'a::result' : no appropriate default constructor available so problem guess lack of default constructor, added this: struct result { result::result(int graph_size=0) : g(graph_size){ } int x; ugraph g; }; and problem solved. my question if there way initiate class ugraph g inside constructor of class a? , not inside member struct? thanks. yes, use initializer list in constructor of result : result::result() : g(0) // have insert integer here { } another way in c++11 giv...

perl - Array of hashes manipulation -

i'm running script below query monitoring system , results in array of hashes. best way access individual hashes , elements? use strict; use warnings; use yms::client::monstatus; use getopt::long; use dbi::dumper; use data::dumper; use yms::client::monstatus::filter; $username = "username"; $password = "passwd"; $cluster = "aso"; #my $filter = yms::client::monstatus::filter(); $client = yms::client::monstatus->new($cluster); $client->verbose("on"); $client->byauth({username => $username, password => "$password"}); $client->yms_rotation("bot.ops.com:4080"); $client->debug("on"); $filter = yms::client::monstatus::filter->new(); $filter->add("cluster", "=", "aso"); $filter->add("host", "in", "<hostname>"); #$filter->add("service", "=", "prod-deploy"); $filter->add("stat...

java - Hibernate multitenancy: change tenant in session -

we're developing saas solution several consumers. solution based on spring, wicket , hibernate. our database contains data several customers. we've decided model database follows: public shared data between customers, example user accounts not know customer user belongs to customer_1 customer_2 ... to work setup use multi-tenancy setup following tenantidentifierresolver: public class tenantproviderimpl implements currenttenantidentifierresolver { private static final threadlocal<string> tenant = new threadlocal<>(); public static void settenant(string tenant){ tenantproviderimpl.tenant.set(tenant); } @override public string resolvecurrenttenantidentifier() { return tenant.get(); } @override public boolean validateexistingcurrentsessions() { return false; } /** * initialize tenant storing tenant identifier in both http session , threadlocal * * @param string tenant ...

linux - Why is the following convert command resulting in Segmentation fault? -

this command running (directly command line, logged in root): /usr/bin/convert '/var/storage/files/drupal/273f09ab5f8671d3c457719c7955063f.jpg' -resize 127x127! -quality '75' '/var/storage/files/drupal/imagecache/artwork_moreart/273f09ab5f8671d3c457719c7955063f.jpg' the result of command just: segmentation fault version of imagemagic: imagemagick 6.4.3 2009-02-25 linux version: suse linux enterprise server 11 (x86_64) this image exists , have copied local computer , opened no issue. please let me know if there additional information need , how information. try correct command. ! needs backslash-escaping, first of all, otherwise interpreted shell, instead of convert : /usr/bin/convert \ '/var/storage/files/drupal/273f09ab5f8671d3c457719c7955063f.jpg' \ -resize 127x127\! -quality '75' \ '/var/storage/files/drupal/imagecache/artwork_moreart/273f09ab5f8671d3c457719c7955063f.jpg' if doesn't work, try surro...

visible-xs-block and visible-sm-block bootstrap 3.3.4 not working -

using bs 3.3.4 i've tried hidden-xs-block , hidden-sm-block on divs still display on iphone 3, iphone 4. way work new class display:none on media query prefer using built in functionality. applied class directly in <div class="panel panel-default hidden-sm-block "> hidden-xs-block see: http://howlingwolfmedia.com/dev/jrmasonry_btstrp/portfolio.html right side panel hidden using custom class turned off see i'm talking about. see orginal code there hidden-x , visible-x without -block classes available. e.g. @media (max-width: 767px) { .hidden-xs { display: none !important; } } @media (min-width: 768px) , (max-width: 991px) { .hidden-sm { display: none !important; } }

java - Generate fragments of html view template in Play Framework -

i know how generate html in java, , pass view using parameter. how can achieve this? i've searched official play framework documentation, nothing found it. i know possible because can pass 1 template using variable. in case generate view on java. f.e. create method display in inherited classes generate ready use html code. please help playframework 2.2.6 why won't use play.twirl.api.html ? your action: public result youraction() { html myhtml = new html("<h1>it works out of box</h1>"); return ok(yourview.render(myhtml)); } yourview.scala.html @(myhtml: html) code: @myhtml works out of box, @ least play 2.3+

javascript - Can I import data to MapBox programmatically? -

if it's possbile import data mapbox. import data mapbox using javascript api load maps ? example : in dataset (c#) have following column : country | state | city | zipcode values : usa | alabama | memphis | 38104 based on above value need show mapbox - maps ? how ? any idea ?

TYPO3 6.2 performance, Typoscript Select, Typoscript Cache -

the problem solved, question still open cause want test tipps krystian. see edit 3 @ bottom of question. i have typo3 project slow. did tests , found problems. i tested startpage, startpage containers 2 news list (total 9 articles) (tx_news version 2.3.0 - not newest one). contains menu (created fluid v:page.menu), footer (also created v:page.menu), right column (mainly image content elements, gathered page typoscript) , news-taglist (created typoscript). news-taglist used twice - once in menu , once in right column. first performance overview: no menu/no footer (without taglist), no news, no labellist 0.65s menu , footer (without taglist) 0.95s menu , footer (with taglist) 2.3s menu , footer (with taglist) , taglist in right column 3s 4.2s a big point taglist (right there total of 1303 tags). here typoscript generate taglist: plugin.tx_mytemplate { newstags = content newstags { table = tx_news_domain_model_tag select { pidinlist...

java - After redirect code still executing from previos page -

how system.out.println("") executed after response has been redirected other resource. in code: res.sendredirect("/more_value_in_param/display.jsp"); system.out.println("to avoid penalty , disconnection"); why in console to avoid penalty , disconnection being displayed since response has been redirected display.jsp ? the sendredirect() method not halt execution of method. should either branch code in such way call sendredirect() last statement in method or explicitly call return; after calling sendredirect() .

c# - Make input to Web Service field optional not required -

i created sample webservice ask user information , return in json form information required. have 2 issues here i don't want make required user enter bot new dates , renewal dates, want make 1 of them required while other 1 optional if both dates, new , renewal, entered user in 1 json not sure how append both lists together. please let me know if need additional information, here code webservice namespace webservicetest { /// <summary> /// summary description webserviceprueba /// </summary> [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] // allow web service called script, using asp.net ajax, uncomment following line. // [system.web.script.services.scriptservice] public class webserviceprueba : system.web.services.webservice { private string use...

sql - Update prices in mysql -

this how articles table looks like: (tbl_articles) id | short_description | description | gross | net 1 | v00556 | valve washroom | 9.00 | 7.49 etc. my supplier provided me new price list, in format (tbl_supplier) short_description | description | gross | net v0056 | valve washroom | 9.50 | 7.99 how can update price list prices? have in common short description column, has new articles. both lists contain on 10,000 articles , exporting excel + vertical search not work. i tried this, without success: update tbl_articles set gross = ( select gross tbl_supplier tbl_articles.short_description = tbl_supplier.short_description ) shortcomings: new products not added in table cannot update 2 fields create unique index on short_description : create unique index idx_articles_shortdesc on articles(short_description); then use insert . . . on dup...

javascript - How do I manage private packages that are intended to be used by multiple projects in Meteor? -

this question has answer here: how share private meteor packages between multiple projects? 2 answers i'm starting learn packages , in attempt modulize app , break out parts potentially re-use other apps down line, i'd put common functionalities within packages. so packages published in atmosphere type in meteor add , give me latest version of it. however, not want these packages published on atmosphere. wondering best way manage it? do create each of these packages in own project folder , manually copy contents packages folder of each app utilises it? if so, how ensure latest version copied each of solution? is there way can use meteor add point git repository or private location instead of atmosphere? meteor search local packages directories defined environment variables: package_dirs .

How to get connection status in the C# MongoDB driver v2.0? -

we starting using new mongodb driver v2 , can't understand whether connected db or not. our repository code: var client = new mongoclient("mongodb://{wrong-host}:{wrong-port}/{dbbname}"); var database = client.getdatabase(url.databasename); where wrong-host , wrong-port invalid values. first thought exception raised if no 1 listening on specified address driver doesn't throws. next step invoke method on db: var dbs = client.listdatabasesasync().result.tolistasync().result; here have freez 30 seconds , exception. not suitable wait 30 seconds know connected or not. system.timeoutexception: timeout occured after 30000ms selecting server using compositeserverselector{ selectors = readpreferenceserverselector{ readpreference = { mode = primary, tagsets = [] } }, latencylimitingserverselector{ allowedlatencyrange = 00:00:00.0150000 } }. client view of cluster state { clusterid : "1", type : "unknown", state : "dis...

java - Converting string to readable SimpleDateFormat -

i trying add spaces string can use simpledateformat . need add spaces this: string str = "wed 3jun15 03:22:15 pm" i know how put simpledateformat format: string str = "wed 3 jun 15 03:22:15 pm" eventually trying pull d, hh:mm out of date, rest can trashed. i have looked @ link: how split string between letters , digits (or between digits , letters)? , while closed, doesn't work trying do. this pattern should match string: eee dmmmyy hh:mm:ss with example: string str = "wed 3jun15 03:22:15 pm"; simpledateformat fmt = new simpledateformat("eee ddmmmyy hh:mm:ss a"); date d = fmt.parse(str); simpledateformat output = new simpledateformat("d, hh:mm"); system.out.println(output.format(d)); //prints 3, 15:22

ubuntu 14.04 - Docker container returns "unknown" for "uname -p" command -

i installed brand new ubuntu server 14.04.2 lts , installed docker run containers. facing problems it. container used run jenkins , of jobs runs scripts install android ndk/sdk. these scripts checking platform of current machine using uname -p command. command runs on host machine returns unknown in containers follows: lemonade@olympus:/$ docker info containers: 14 images: 171 storage driver: aufs root dir: /var/lib/docker/aufs dirs: 199 execution driver: native-0.2 kernel version: 3.16.0-38-generic warning: no swap limit support lemonade@olympus:/$ uname -a linux olympus 3.16.0-38-generic #52~14.04.1-ubuntu smp fri may 8 09:43:57 utc 2015 x86_64 x86_64 x86_64 gnu/linux lemonade@olympus:/$ uname -p x86_64 lemonade@olympus:/$ docker run -ti java:7 /bin/bash root@c6cdbb8a64fb:/# uname -p unknown root@c6cdbb8a64fb:/# uname -a linux c6cdbb8a64fb 3.16.0-38-generic #52~14.04.1-ubuntu smp fri may 8 09:43:57 utc 2015 x86_64 gnu/linux does knows why containers returning this? script...

How to set/get GPS Accuracy on Android Emulator? -

is there way set or gps accuracy in android emulator? via telnet can set longitude , latitude no accuracy. there way? or how android calculates accuracy in general, there way influence it? what trying ask, how additional gps functionality (google api map services), installed on phone. @ time of writing this, can create avd using "google apis intel atom (x86)".

c++ - Windows Service Command line parameters with Automatic Start -

i wrote simple windows service based on this sample. need pass couple of parameters service, command line parameters (reading service registry hive not work on windows7). tried solution described here not work: when add parameters value in <myservice>\imagepath entry (i.e "d:\myservice.exe" "-param1" "-param2" ) service fails start. .

lua 5.2.3 source lstring.c function luaS_resize -

void luas_resize (lua_state *l, int newsize) { int i; stringtable *tb = &g(l)->strt; /* cannot resize while gc traversing strings */ luac_runtilstate(l, ~bitmask(gcssweepstring)); if (newsize > tb->size) { luam_reallocvector(l, tb->hash, tb->size, newsize, gcobject *); (i = tb->size; < newsize; i++) tb->hash[i] = null; } /* rehash */ (i=0; i<tb->size; i++) { gcobject *p = tb->hash[i]; tb->hash[i] = null; while (p) { /* each node in list */ gcobject *next = gch(p)->next; /* save next */ unsigned int h = lmod(gco2ts(p)->hash, newsize); /* new position */ gch(p)->next = tb->hash[h]; /* chain */ tb->hash[h] = p; resetoldbit(p); /* see move old rule */ p = next; } } if (newsize < tb->size) { /* shrinking slice must empty */ lua_assert(tb->hash[newsize] == null && tb->hash[tb->size - 1] == null); luam_reallocvector(...

php - read out every char of (icon-) font -

i have (icon-)font , want read php out possible icons (chars) available in font list them. there php function or libary makes possible? doesnt matter filetype font because of them available: svg, eot, ttf, woff. edit: on github: https://github.com/blacksunshinecoding/svgfontreader now have found solution , built class it: class svgfontreader { function listglyphs($svgfile) { $allglyphs = $this->getglyphs($svgfile); return implode(',', $allglyphs); } function getglyphs($svgfile) { $svgcopy = 'font.svg'; if (file_exists($svgcopy)) { unlink($svgcopy); } copy($svgfile, $svgcopy); $svgcontent = file_get_contents($svgcopy); $xmlinit = simplexml_load_string($svgcontent); $svgjson = json_encode($xmlinit); $svgarray = json_decode($svgjson, true); $svgglyphs = $svgarray['defs']['font']['glyph']; if (count($svgg...

r - Apply list of functions to list of values -

in reference this question , trying figure out simplest way apply list of functions list of values. basically, nested lapply . example, here apply sd , mean built in data set trees : funs <- list(sd=sd, mean=mean) sapply(funs, function(x) sapply(trees, x)) to get: sd mean girth 3.138139 13.24839 height 6.371813 76.00000 volume 16.437846 30.17097 but hoping avoid inner function , have like: sapply(funs, sapply, x=trees) which doesn't work because x matches first sapply instead of second. can functional::curry : sapply(funs, curry(sapply, x=trees)) but hoping maybe there clever way positional , name matching i'm missing. since mapply use ellipsis ... pass vectors (atomics or lists) , not named argument (x) in sapply, lapply, etc ... don't need name parameter x = trees if use mapply instead of sapply : funs <- list(sd = sd, mean = mean) x <- sapply(funs, function(x) sapply(trees, x)) y <- sapply(funs...

multithreading - Exception java in thread java.util.NoSuchElementExcpetion -

i have thread must verify if sting equal @ 1 of error. if yes, put flag=1. trouble thread never enter in if , gives exception: java.util.nosuchelementexcpetion: no line found . part of code: string can = string.valueof(jcombobox1.getselecteditem()); string pad = string.valueof(jcombobox2.getselecteditem()); final string err = string.valueof("warning: no pad nodes found on channel "+can+" . exit!"); final countdownlatch latch = new countdownlatch(1); final int[] flag = new int[1]; flag[0]=0; try { if(pathfile!=null){ p = runtime.getruntime().exec("testpad -i -c"+can+" -n"+pad+" "+pathfile); final inputstream instream = p.getinputstream(); thread uithread = new thread("uihandler") { @override public void run() { inputstreamreader reader = new inputstreamreader(instream); scanner scan =...

creating multidimension array with multiple coloumn in perl -

id cat 1 car 2 education 3 mathematics 4 physics 5 astrophysics based on list, want generate , access array in following manner: array ( [0] => array ( [id] => 1 [cat] => car ) [1] => array ( [id] => 2 [cat] => education ) [2] => array ( [id] => 3 [cat] => mathematics ) ) and on till end of array. a simple way read file, line-by-line, split each line id , category portions , use create array of hash references : use strict; use warnings; use data::dumper; @categories; while ( $row = <data> ) { ($id, $cat) = $row =~ m/(\d+)\s+(\w+)/; push @categories, { id => $id, cat => $cat }; } print dumper \@categories; __data__ 1 car 2 education 3 mathematics 4 physics 5 astrophysics output: $var1 = [ { 'cat' =>...

Appium: Change Android DatePicker value Javascript/NodeJS -

we trying automate testing hybrid android app stuck on date picker. want change value within date picker specific date (jun. -> may). therefore have retrieved edittext element , tried change text. we have tried 2 possibilities: setting text directly using sendkeys(); and first selecting text , setting text using first option appium told text not removed (using appium 1.4.0, sendkeys should clear edit text). instead first 2 characters removed , stuck characters "n.". have tried setting text (by using sendkeys()) on number picker (changed android.widget.edittext -> android.widget.numberpicker). driver.elementsbyclassname("android.widget.edittext").then(function (promisses) { var promise = promisses[0]; return promise.sendkeys('may').setimplicitwaittimeout(3000); }); with second option tried using touch action (wd.touchaction) long press input field , selecting whole text. used sendkeys overwrite selected text. problem option usin...

c# - Intercept object arrives Controller -

i have controllers get/post methods , wondering if it's possible intercept object before reach post method on controller. here method on controller: [route("{type}")] [httppost] public httpresponsemessage save(string type, [frombody] message message) { .... return request.createresponse((httpstatuscode)200, result); } is possible intercept object message before method save() has been called? i've created delegatinghandler it's not working. here how i've added route: ihttproute route = globalconfiguration.configuration.routes.createroute( routetemplate: "api/message/{type}", defaults: new httproutevaluedictionary("route"), constraints: null, datatokens: null, handler: new validationhandler()); globalconfiguration.configuration.routes.add("myroute", route); any ideas how can it? if have created delegatinghandler need configure follows: globalconfiguration.configuration .mess...

ios - Get SecKeyRef from modulus/exponent -

i have rsa key (pair) represented big integeger modulus , exponent , need encrypt/decrypt those. i figured out how handle keys needed in ios using swift. to question: there way convert modulus/exponent representation standard seckeyref? both formatted big int (coming android), modulus example looks this: 23986589886077318012326064844037831693417390067186403792990846282531380456965701688980194375481519508455379138899060072530724598302129656976140458275478340281694599774176865257462922861492999970413042311221914141827738166785420817621605554859384423695247859963064446809695729281306530681131568503935369097838468173777374667631401317163094053418212485192857751897040859007584244053136110895205839896478287122804119514727484734998762296502939823974188856604771622873660784676915716476754048257418841069214486772931445697194023455179601077893872576165858771367831752886749210944303260745331014786145738511592470796648651 i had same task - given modulus , exponent had cre...

How to use different network interface for signaling & media in WebRTC app? -

i use different network interfaces signaling , media (webrtc programming). suppose have more 1 network interface 1 lan & other wifi or usb modem etc. 1. signaling should happened via lan. 2. media (video/audio) should use network interface wi-fi or usb modem. could please suggest how achieve above scenario in webrtc application?

javascript - JS is not being executed after ajax call -

i'm calling php script includes js code calling xmlhttprequest.send. unfortunatly javascript code in called php script not being executed. the calling routine: var formdata = new formdata(); formdata.append("uploadfilename", file); var ajax = new xmlhttprequest(); ajax.upload.addeventlistener("progress", progresshandler, false); ajax.addeventlistener("load", completehandler, false); ajax.addeventlistener("error", errorhandler, false); ajax.addeventlistener("abort", aborthandler, false); ajax.open("post", "mod/intern/uploader_upload_done.php"); ajax.send(formdata); any javascript in called script fails, alert() call. file uploader_upload_done.php: <?php echo date(); ?> <script>alert("hallo");</script> when calling uploader_upload_done.php directly, works should. what doing wrong? as understand make ajax call php file, , expect javascript there executed. shou...

java - JavaFX TextArea. The application crashes when using appendText too quick. Any suggestion? -

i updating string content of javafx.scene.control. textarea different thread, adding sentence @ time. this listener method append textarea (named display ): public void onstatus(status status) { if(userfilters.statusmatches(status)){ display.appendtext("@" + status.getuser().getscreenname() + "\n" + status.gettext() + "\n-------------\n"); } } if rate of posting not excessively quick, works. otherwise, if incoming messages many (e.g. public posts taken social network), application 'graphical update' crash after few of them. the exceptions not refers elements of code have written. not know how catch them , stop application in sort of clean way. (by way, not trying append null element.) these exceptions: exception in thread "javafx application thread" java.lang.nullpointerexception @ com.sun.javafx.text.prismtextlayout.getruns(prismtextlayout.java:236) @ jav...

Broadcast intent vs multicast listener implementation on Android -

i want enable several objects subscribe event @ same time. currently see 2 approaches: send broadcast intents, or implement multicast listeners (a manager class containing array of subscribed listeners, , subscribing , unsubscribing functionality) such built-in events in c#. which best practice on android? or there other approach worth considering? you may try localbroadcastmanager , lightweight solution sending broadcast intents, , part of android support library v4.

Issue with Javascript this context -

Image
this question has answer here: how access correct `this` inside callback? 5 answers i'm having issue following code. console.log working fine in logname method not giving desired output in lognameagain method. tried google in vain. please explain going on here? var testobj = { name: "this test object", logname: function() { console.log(this.name); //works fine function lognameagain() { console.log(this.name); //not giving expected result; } lognameagain(); } }; testobj.logname(); jsfiddle seems console.log in lognameagain method pointing window . doesn't make sense me? update: understand can fixed using bind/call or self don't understand why happening? try using .bind() (see working jsfiddle ): var testobj = { name: "this test object", logna...

objective c - UIButton error with SKPayment -

i used tutorial how add in-app purchase ios application? skpayment (verbatim) , having trouble linking purchase buttons on storyboard code. - (ibaction)purchase:(skproduct *)product{ i keep getting following error. [uibutton productidentifier]: unrecognized selector sent instance 0x7ffa08cfbe90 i understand tutorial uses xib file using storyboard file game link buttons. can please tell me how link purchase button in storyboard the - (ibaction)purchase:(skproduct *)product{ code without getting unrecognized selector error? it's because ibaction expects sender first parameter. , when it's "linked" uibutton , uibutton sender (it's automatically sent). why error, uibutton doesn't know selector productidentifier . if answer linked on so, methods linked ib aren't one. 1 called [self purchase:someskproduct] , that's why it's not causing crash on his/her code. well, haven't played storekitframework, seems method shoul...

node.js - Is it possible to send data directly to a constructor? -

first time using node.js, mongodb, express web-development. say have constructor 'createobject' in file separate routing or driver file. can use module.exports.createobject , , require , create object within driver, can call single function , have database insert data directly object me when call in routing file? (i.e. 'when user visits page, import createobject constructor, db.insert(createobject object, data) , export information our display functions) does export work that? i'm trying avoid routing every file display functions adding each entry array './:collection/:item' . express doesn't care constructors or objects. can use them, need plumbing use them within middleware function. instead, might want think in terms of middleware functions. a common pattern in node development define 1 (or more) middleware functions in other files , require app. can chain arbitrary number of middleware functions , attach them route. this: // a...

model view controller - Understanding MVC in a QAbstractTableModel -

i have data represented class of own ; fix ideas give example. class myownmodel(): def __init__(self, name="", number=0): self.name = name self.number = number i have list of such instances, want represent in qtableview. li = [myownmodel("a", 1), myownmodel("b", 2)] then see 2 strategies make qtableview : change myownmodel subclasses qabstracttablemodel build new qabstracttablemodel mimics myownmodel in way attributes instance 2 qstring , connect datachanged signal function updates instance of myownmodel i not satisfied of these, have no other idea moment... which 1 suitable problem ? (i have more complex class in practice use same framework) as stated in comment, model list of object. should subclass qabstracttablemodel use list. here's code snippet this: import sys import signal import pyqt4.qtcore pcore import pyqt4.qtgui pgui class onerow(pcore.qobject): def __init__(self): self.column0=...

templates - c++ va_list function overload -

i have 2 function overloads: void log(const char* format, ...); void log(const string& message); and want in case of call: log("hello"); string version called, or in other words first overload should called in case of 2 arguments or more. i thought doing this: template<typename t> void log(const char* format, t first, ...); but in case have trouble using va_list in code. is there other solution might missing? edit : thought checking size of va_list inside function, , redirecting in case of 0, far understood it's impossible size of va_list . force type construction: log(std::string{"hello}) . isn't seem want. in either of functions, call other one. void log(const string& s) { log(s.c_str()); } but it's not efficient because you'll have useless string object, although compiler may able inline call. use variadic templates , sfinae: void log(const string&); auto log(const char *ptr, args...

django - add extra field to ModelForm -

i adding field django modelform that: class form(forms.modelform): extra_field = forms.charfield(label='name of institution') class meta: model = db_institutioninstitution fields = ['conn_kind','time','inst_name2'] the form working fine, cant prepopulate it. use in modelformset_factory : formset = modelformset_factory(db_institutioninstitution,form=form) i manually run through queryset , add entry in dictionary needed additional form in formset. however, when call: formset1 = formset(prefix='brch',queryset=qs1) the extra_field not prepopulated intended (the rest working fine). can help? if want set default. extra_field = forms.charfield(label='name of institution', default="harvard") if want dynamically set value: def __init__(self, *args, **kwargs): super(form,self).__init(*args, **kwargs) self.fields['extra_field'].initial = "harvard"

php - What's a good way to test a user factory that depends on an external API call -

i've got pretty straight forward user factory, except depending on external api call. since external call has authenticated particular user details i'm not sure if somehow have mock response or request? my question if there suggestions on way user test factory? thanks! public static function getuser($id) { if (!integervalidator::valid($id)) { throw new validationexception('invalid id provided'); } $path = "/users/{$id}"; $cache = memcachedmanager::get($path); if ($cache) { return $cache; } $client = clientfactory::getclient(); $result = $client->get($path); $user = static::createuserfromresult($result); memcachedmanager::set($path, $result); return $user; } to make testable need refactor code. can mock dependencies in phpunit , create mock response public api method calls. want achieve, need inject clientfactory method , can use mock object in it's place unit test. ...

Spring SAML to make a direct SOAP call to the Identity Provider -

i new extension, i've been reading documentation in 1 part stays "usage of http-artifact binding requires spring saml make direct soap call identity provider". please, fix me if mistaken: mean possible send soap message identity provider authentication, avoiding need redirecting idp login page?. if not, feature for?. is related /saml/sso/ endpoint? thank much. http-artifact binding used deliver saml message idp sp. avoids delivery through user's browser (which case http-post binding), saml exchanged between servers. there no standard way authenticate using soap saml 2.0 websso profiles.

Android NDK - multlib support using gradle -

my question directed towards native android development 64bit android systems. i looking way configure support of 32bit compiled native libraries @ 64bit android system using gradle build system. libraries application should use available 32bit build. time consuming , error prone port these libraries 64bit. hence, want configure gradle deploy these prebuilt 32bit binaries , use 32bit version of android application well. the current configuration leads following error: e/androidruntime﹕ fatal exception: main process: <application_name>, pid: 2170 java.lang.unsatisfiedlinkerror: dalvik.system.pathclassloader [dexpathlist[[zip file "/data/app/<application_name>/base.apk"], nativelibrarydirectories=[/vendor/lib64, /system/lib64]]] enter code here`couldn't find "libmynativelibrary.so" @ java.lang.runtime.loadlibrary(runtime.java:366) it seems though pathclassloader looks in wrong directories. checked provided apk file , lacki...

c# - Simple Injector Dependency Resolution Error -

i following onion architecture , using simple injector in dependencyresolution project. here architecture: 1-core - domain classes - repository interfaces - service interfaces 2-infrastructure - data - dependency resolution - repository interfaces implementation - service interfaces implementation 3-webapi - web api project 4-webclient - angularjs app 5-test - test project startup.cs public partial class startup { public void configuration(iappbuilder app) { // here getting error @ runtime. simpleinjectorinitializer.initialize(app); configureauth(app); } } simpleinjectorinitializer.initialize public static container initialize(iappbuilder app) { var container = getinitializecontainer(app); // extension method integration package. container.registerwebapicontrollers(globalconfiguration.configuration); ...