Posts

Showing posts from May, 2013

python - Can pyzmq publishers be operated from class instances? -

i have following code publisher, instantiates few class instances , publishes messages. however, don't receive @ subscriber side. publisher import zmq import time multiprocessing import process class senddata: def __init__(self, msg, port): self.msg = msg self.port = port ctx = zmq.context() self.sock = ctx.socket(zmq.pub) self.sock.bind('tcp://127.0.0.1:'+str(self.port)) time.sleep(1) def sender(self): self.sock.send_json(self.msg) def main(): device, port in zip(['2.2.2.2', '5.5.5.5'],[5001, 5002]): msg = {device:'some random message'} instance = senddata(device, port) process(target=instance.sender).start() if __name__ == "__main__": main() subscriber import zmq ctx = zmq.context() recv_sock1 = ctx.socket(zmq.sub) recv_sock1.connect('tcp://127.0.0.1:5001') recv_sock1.setsockopt(zmq.subscribe, '') recv_sock2

sql server - C# transaction with handled exception will still roll back? -

considering piece of code: using(transactionscope tran = new transactionscope()) { insertstatementmethod1(); insertstatementmethod2(); // might fail try { insertstatementmethod3(); } catch (exception e) { // nothing } tran.complete(); } is done in insertstatementmethod1 , insertstatementmethod2 going rolled back? in case? if want them execute anyway, need check if insertstatementmethod3 fail before transaction, , build transaction code based on that? update the code looks similar this using(transactionscope tran = new transactionscope()) { // <standard code> yourextracode(); // <standard code> tran.complete(); } where write yourextracode() method public void yourextracode() { insertstatementmethod1(); insertstatementmethod2(); // call might fail insertstatementmethod3(); } i can edit yourextracode() method, cannot chose in transaction scope or no. 1 simple possible soluti

elasticsearch - can i run multiple instance of logstash in the same server? -

i want rss feed 5 news website rss logstash input plugin , tweet of twitter twitter plugin create 1 logstash config file rss , 1 twitter. question is, can run multiple instance of logstash command bin/logstash -f first_config.conf , bin/logstash -f second_config.conf if do, face bottleneck problem ? you want run "multiple pipelines". if need run more 1 pipeline in same process, logstash provides way through configuration file called pipelines.yml. see docs in link.

java - cannot resolved method getChildFragmentManager() -

error: 'childfragmentmanager' parameter can used if getchildfragmentmanager() method available in android.support.v4.app.fragment, update support library version. i have compile 'com.android.support:support-v4:24.2.0' in gradle. code like; import android.support.v4.app.fragment; import org.androidannotations.annotations.*; import org.androidannotations.annotations.sharedpreferences.pref; . . @efragment(r.layout.fragment_main) public class mainfragment extends fragment { @pref applicationsettings_ applicationsettings; @viewbyid(r.id.bot) public linearlayout bot; @viewbyid(r.id.center) public linearlayout center; @bean uiitemgenerator uiitemgenerator; @systemservice layoutinflater layoutinflater; @fragmentbyid(value = r.id.contentfragment,childfragment = true) public contentfragment contentfragment; public mainfragment() { } @click(r.id.imagebutton_ribbon) public void ribbonclick(view view) { view.setvisibility(view.gone); } . . . @afterviews public vo

arrays - Moving object, maze game -

i'm new in java , right working on simple maze game. thing is, object moving in console doesn't on scene, seems object not updated on gridpane. have tried many things can not find, problem, may need animationtimer update gridpane?: this 1 part of moving, (array located in method): tilemap.add(hero.getplayer(); hero.getx()/50; hero.gety()/50); public void mapscene2() { tilemap = new gridpane(); stage stage = new stage(); scene scene = new scene( tilemap, maplengthtiles * tilesizepx, maplengthtiles * tilesizepx ); scene.setonkeypressed( new eventhandler<keyevent>() { @override public void handle(keyevent event) { switch (event.getcode()) { case a: case left: { hero.move( -50, 0, -1, 0 ); system.out.println( "move left" ); break; } class of pl

php - Adding text field inside of checkbox -

<input type="checkbox" name="check_list[]" value="<?echo $row->field_id?>" <?echo $checked?> > <?php echo $row->field_display_name;?><br/> here $row->field_id field name,how can change text field. wanted show text field.

java - Gate- Loading a gapp file is taking time .Hoe can I reduce it? -

i working on gate related project. so, here creating pipeline through gate. using .gapp file in java code. so, loading .gapp file, takes around 10 seconds, application. how can solve issue? second problem that, have system.exit after processing document release memory, if didn't got outofmemoryerror. so, how can solve these issues? my code like: public class gatemainclass { corpuscontroller application = null; corpus corpus = null; public void processapp(string gatehome, string gapfilepath, string docsourcepath, string issingledocument) throws resourceinstantiationexception { try { if (!gate.isinitialised()) { gate.runinsandbox(true); gate.setgatehome(new file(gatehome)); gate.setpluginshome(new file(gatehome, "plugins")); gate.init(); } application = (corpuscontroller) persistencemanager.loadobjectfromfile(new file(gapfilepath));

node.js - WebStorm remote debugging NodeJS with Babel -

i'm running node application with: "./node_modules/nodemon/bin/nodemon.js --ignore ./build/* ./bin/www --exec babel-node --debug=7001", when connect webstorm remote configuration seems work, placing breakpoint results in either them being ignored, or code stop @ different lines. this due babel transpiling. how can that, given code transpiled @ runtime? my .babelrc file: { "presets": ["es2015", "stage-2"], "plugins": ["transform-runtime"] } here revelent documentation : https://blog.jetbrains.com/webstorm/2015/05/ecmascript-6-in-webstorm-transpiling/ if you’d debug code using webstorm or chrome, make sure tools you’re using generates source maps . example, when using babel only, need add "sourcemaps": "both" option .babelrc file or pass command-line argument. if you’re using babel part of more complex build process, might need addition configuration generating s

php - To add remainder email in yii using crontab -

as suggested created file messengercommand.php under protected/commands class messengercommand extends cconsolecommand { public function run($args) { /* if(erunactions::runbackground()) { */ $mail=yii::app()->smtpmail; $mail->setfrom("tsadmin@softthink.com", 'from name'); $mail->subject ="hello"; $mail->msghtml("haiii workd"); $mail->addaddress("rajesh.udutha@itaugments.com", ""); if(!$mail->send()) { echo "mailer error: " . $mail->errorinfo; }else { echo "message sent!"; } } } and added yiic command as $path = dirname(__file__); //echo $path; shell_exec( $path . "/protected/yiic messenger" ); and trigger email when load site .... but dont wanna refresh site ..i need make run in background ..please me. you can use yii console applications a

Android Firebase CacheExpiration set to zero? -

in app, user need retrieve string @ 2pm every day remote config, set cacheexpiration 0 retrieve immediately. possible there throttling if have many users? if there throttling, return "task.issuccessful" or "fail"? throttling happens when client exceeds rate limit fetch requests, regardless of configuration. if fetch every day @ time on each users' device, not problem. if code rate limited, task (on android) fail appropriate message in exception.

javascript - Navigator.sendBeacon() to pass header information -

i using navigator communicating server , problem need pass header information there filter recognise request valid source. can on this? thanks. @vipul panth has helpful information, wanted provide more complete details. first, note navigator.sendbeacon not supported in browsers. see more detail function supported browsers @ mdn documentation . you indeed create blob provide headers. here example: window.onunload = function () { let body = { id, email }; let headers = { type: 'application/json' }; let blob = new blob([json.stringify(body)], headers); navigator.sendbeacon('url', blob); }); navigator.sendbeacon send post request content-type request header set whatever in headers.type . seems header can set in beacon though, per w3c : the sendbeacon method not provide ability customize request method, provide custom request headers, or change other processing properties of request , response. applications require non

sql server - Converting a float number in 0-1 range to time -

in application time info stored in db in float field, where: 0 means 0 am; 0.5 12 0,999305555555556 11:59 pm the conversion time information done in application ui components designed work way save time info float (this decided before time datatype introduced in sql server 2008r2). my question is: how perform conversion? minute has 60 seconds, hour has 3600 seconds, day has 86400 seconds, multiply (0-1) float 86400 (let's call total_seconds), 1) floor of division of total_seconds 3600 hours 2) subtract hours*3600 total_seconds 3) floor of division of total_seconds 60 minutes 4) subtract minutes*60 total_seconds 6) what's left seconds declare @raw_input float = 0.999305555555556 declare @total_seconds int declare @hours int, @minutes int, @seconds int set @total_seconds = @raw_input * 86400 set @hours = floor(@total_seconds/3600) set @total_seconds = @total_seconds - @hours * 3600 set @minutes = floor(@total_seconds/60) set @seconds = @total

java - What if I start a thread in infinite loop and update my database? -

class sendmail implements runnable { thread oraclebakthread; thread sleepthread = new thread(this); public static void main(string args[]){ sendmail objsendmail= new sendmail(); objsendmail.startinfiniteloop(); } public void startinfiniteloop() { for(;;) { sleepthread.sleep(1000); oraclebakthread = new thread(this); oraclebakthread.start();} } public void getbackupfun() { dbconnectionfactory objdbconnectionfactory = new dbconnectionfactory(); properties props = new properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); query = "check if database false"; while (rs.next()) { // if database true, send mail, update database } } public void run() { int minute=0;

When someone suggests a directory location in Android, where am I suppose to look? -

i have android question: when links file directory, suppose look? e.g. suggested make changes in a2dp bluetooth profile in /external/bluetooth/bluedroid/include/bt_target.h. android device receiver a2dp profile /external/bluetooth/bluedroid/include/bt_target.h. ? is on device? on pc? under android program files? c:\program files\android or android studio projects file? c:\users\someuser\androidstudioprojects help appreciated // david "you download android os source code site. make change in file. compile os modified sources , flash device it" – gserg

docker - Error creating default \"bridge\" network: cannot create network (docker0): conflicts with network (docker0): networks have same bridge name -

after stopping docker refused start again. complaint bridge called docker0 exists: level=warning msg="devmapper: base device exists , has filesystem xfs on it. user specified filesystem ignored." level=info msg="[graphdriver] using prior storage driver \"devicemapper\"" level=info msg="graph migration content-addressability took 0.00 seconds" level=info msg="firewalld running: false" level=info msg="default bridge (docker0) assigned ip address 172.17.0.0/16. daemon option --bip can used set preferred ip address" level=fatal msg="error starting daemon: error initializing network controller: error creating default \"bridge\" network: cannot create network fa74b0de61a17ffe68b9a8f7c1cd698692fb56f6151a7898d66a30350ca0085f (docker0): conflicts network bb9e0aab24dd1f4e61f8e7a46d4801875ade36af79d7d868c9a6ddf55070d4d7 (docker0): networks have same bridge name" docker.service: main process exited, code=exited,

amazon web services - S3 to Redshift : Copy with Access Denied -

we used copy files s3 redshift using copy command every day, bucket no specific policy. copy schema.table_staging 's3://our-bucket/x/yyyy/mm/dd/' credentials 'aws_access_key_id=xxxxxx;aws_secret_access_key=xxxxxx' csv gzip delimiter '|' timeformat 'yyyy-mm-dd hh24:mi:ss'; as needed improve security of our s3 bucket, added policy authorize connections either our vpc (the 1 use our redshift cluster) or specific ip address. { "version": "2012-10-17", "id": "s3policyid1", "statement": [ { "sid": "denyallexcept", "effect": "deny", "principal": "*", "action": "s3:*", "resource": [ "arn:aws:s3:::our-bucket/*", "arn:aws:s3:::our-bucket" ], "condition": { "

time series - Apply a function rowwise for calculating percentage changes in R -

this question has answer here: how create lag variable within each group? 3 answers i have yearly time series data in long format @ group-state-brand level. want apply function calculate growth rates yoy every level. basically (currentvalue/previous value) -1 find below extract of data: grp sta brnd yr sls al ben's 2012 29770 al ben's 2013 23357 al ben's 2014 22442 al ben's 2015 21848 al ben's 2016 13799 b ca scott's 2012 1079 b ca scott's 2013 11178 b ca scott's 2014 14778 b ca scott's 2015 15241 b ca scott's 2016 10569 c tx joey's 2012 1673 c tx joey's 2013 1290 c tx joey's 2014 899 c tx joey's 2015 732 c tx joey's 2016 294 basically, each unique level of grp-state-brand 5 rows. grp s

python 2.7 - ValueError: This solver needs samples of at least 2 classes in the data, but the data contains only one class: 0.0 -

i have applied logistic regression on train set after splitting data set test , train sets, got above error. tried work out, , when tried print response vector y_train in console prints integer values 0 or 1. when wrote file found values float numbers 0.0 , 1.0. if thats problem, how can on come it. lenreg = logisticregression() print y_train[0:10] y_train.to_csv(path='ytard.csv') lenreg.fit(x_train, y_train) y_pred = lenreg.predict(x_test) print metics.accuracy_score(y_test, y_pred) stracktrace follows, traceback (most recent call last): file "/home/amey/prog/pd.py", line 82, in lenreg.fit(x_train, y_train) file "/usr/lib/python2.7/dist-packages/sklearn/linear_model/logistic.py", line 1154, in fit self.max_iter, self.tol, self.random_state) file "/usr/lib/python2.7/dist-packages/sklearn/svm/base.py", line 885, in _fit_liblinear " class: %r" % classes_[0]) valueerror: solver needs samples of @ least 2 classes in

ios - Swift3 version for emojilessStringWithSubstitution -

my current implementation has : var emojilessstringwithsubstitution: string { let emojipatterns = [unicodescalar(0x10000)...unicodescalar(0x10ffff), unicodescalar(0x2600)...unicodescalar(0x27ff)] return self.unicodescalars .filter { ucscalar in !(emojipatterns.contains{ $0 ~= ucscalar }) } .reduce("") { $0 + string($1) } } errors occur : 1. integer literals overflow when stored uint8 2. when store unicode scalar in variables , try assign error binary operator '...' cannot applied 2 'unicodescalar?' operands kindly help. modify code below, var emojilessstringwithsubstitution: string { let emojipatterns = [0x10000...0x10ffff, 0x2600...0x27ff] return self.unicodescalars .filter { ucscalar in !(emojipatterns.contains{ $0 ~= int(ucscalar.value) }) } .reduce("") { $0 + string($1) } }

servicestack - How to configure AppHostBase virtual methods? -

apphostbase has 2 overridable methods can configure inherited application host init() configure(container container) is there rule know better? for instance: container.registeras<smtpemailer, iemailer>().reusedwithin(reusescope.request); ormliteconfig.commandtimeout = 120; container.registervalidators(typeof(customerservice).assembly); plugins.add(new seqrequestlogsfeature(new seqrequestlogssettings(appsettings.getstring("sequrl")))); is better call these lines on init() or configure() or depends? all servicestack configuration should maintained in apphost.configure() abstract method every apphost needs override.

python - Appending two DataFrames and sorting columns with exception of first two -

Image
i'd concatenate 2 data frames, created 2 lists: import pandas pd import numpy np header_1 = ['a', 'b', -1, 3, 5, 7] data_1 = ['x', 'y', 1, 2, 3, 4] d = pd.dataframe(np.array([data_1]), columns=header_1) header_2 = ['a', 'b', -2, 4, 5, 6] data_2 = ['x', 'z', 1, 2, 3, 4] e = pd.dataframe(np.array([data_2]), columns=header_2) f = pd.concat([d, e]) > f b -1 3 5 7 -2 4 6 0 x y 1 2 3 4 nan nan nan 0 x z nan nan 3 nan 1 2 4 however, want numerical columns appear in sorted order , wondering if there easier way splitting off first 2 columns, sorting remaining dataframe , concatenating 2 again: ab_cols = f[['a', 'b']] # copy of first 2 columns g = f.drop(['a', 'b'], axis=1) # removing cols dataframe h = g.sort_index(axis=1) # sort remaining column header = pd.concat([ab_cols, h], axis=1) # putti

unity3d - How to create youtube 360 vr flat cardboard behaviour in Unity -

we've been struggling around trying recreate same input behaviour have when viewing 360 video in youtube when using mobile device in flat mode (viewing while holding in hands). the issue can not swipe screen without messing rotation of camera. using gvr sdk, have camera moving gyro managed gvr, , swipe parent of camera gameobject (since game object updated gvr each frame). this means parent has "swiping" rotation , child (camera) has gyro rotation. swiping input should rotate parent, axis rotate (x , y) should of child object. results getting messed up. anyone has idea how achieve this? cheers! note: in order check mean have watch 360 video youtube in device , make sure not in "cardboard" mode.

java - Row Split exporting to Excel with JasperReports -

Image
i trying export multiple lines excel using dynamicjasper , jasperreports. everything works fine but, when try export excel , excel has more 1 sheet rows splitted content this. anyone knows how fix this? i have tried stretching.relative_to_band_height), isstretchwithoverflow(),.... thanks in advance ok, fixed it setallowdetailsplit false in dynamicreport

c# - Open a web from Winforms with session initialized -

i have winforms application use login authenticate. have asp.net web uses same login parameters , save user in session. i want open web winforms user session initialized, user doesn't needs log again. is possible? with system.diagnostics.process.start(" http://myweb.com?login=xxx&pass=yyy ") can values , simulate login event, don't want pass user parameters in url. suggestions? thanks. the safest way create token table generate login token against userid. when opening site open different page ie. logintoken.aspx , retrieve userid table , save in session. redirect user default page. i not advise passing user credentials via query string.

php - I Want to Assign Multiple Roles to a single user -

i've found below 2 lines inserted somewhere in our theme job done: $addmembertogroup = new wp_user($required_id); $addmembertogroup->add_role( $role ); but dont know place these lines. know put those? on action want assign user role, custom code need put in theme's function.php file (if child theme put in child theme's function.php file) depends on requirement.

javascript - AJAX Import of certain text fiiles produces strange output on Firefox -

Image
i trying import clients .txt file turned js array using ajax call. call works fine on chrome , safari when import file , console log in firefox - see result: if copy of contents of file , paste new .txt file i've created, errors don't display. normally wouldn't issue, client has 6000 of these .txt files use. there should putting in ajax call correct these odd character additions? this current code, reduced core functionality brevity: $(document).ready(function () { $.ajax({ url: "./data/words.txt", success: function (csvd) { console.log(csvd); }, datatype: "text", complete: function () { // levelselect(); } }); });

HTTP POST with NodeMCU module using Arduino IDE -

i have nodemcu wifi module , code in arduino ide. have have problem sending something, using post method , reading page. have php page returns 2 variables. code below: #include <arduino.h> #include <esp8266wifi.h> #include <esp8266wifimulti.h> #include <esp8266httpclient.h> #define use_serial serial esp8266wifimulti wifimulti; httpclient http; void setup() { use_serial.begin(115200); // use_serial.setdebugoutput(true); use_serial.println(); use_serial.println(); use_serial.println(); (uint8_t t = 4; t > 0; t--) { use_serial.printf("[setup] wait %d...\n", t); use_serial.flush(); delay(1000); } wifimulti.addap("ssid", "password"); } void loop() { // wait wifi connection if ((wifimulti.run() == wl_connected)) { httpclient http; use_serial.print("[http] begin...\n"); // configure traged server , url http.begin("ht

javascript - CSS: Things get moved around in scaled-up print preview in Firefox -

Image
page: ( http://progrock.rocks/teaching_materials/loops.html ). it's (css, javascript , html) in 1 file: <!doctype html> <!-- copyright (c) 2016 alf p. steinbach. boost 1.0 license. --> <html> <head> <meta charset="utf-8"> <title>lapper «loops» gruppeøvelse praktisk regning</title> <!-- link rel="stylesheet" href="style.css" --> <style> * { font: 10pt sans-serif; } body { margin: 0; padding: 0; background-color: white; } h1 { padding-left: 14px; padding-top: 0; padding-bottom: 0.5em; padding-right: 0; margin-top: 0; margin-bottom: 0; background-color: lightgray; font-size: xx-large; font-style: italic; color: #a0b0b0; } div#content { margin: 0; padding-left: 0; padding-right: 0;

javascript - GetValue Nested Input JS -

i have html: <div class="alaves"> <h4>admin</h4> <input type="hidden" value=1> </div> //...there have 10 class="alaves" inputs and need if clicked show value; not working. and js: $(document).ready(function () { $('.alaves').click(function () { assert( this.getelementsbytagname('input').val); }); }); i'm guessing mean: $(function (){ $('.alaves').click(function (){ $("input", this).each(function(){ assert(this.value); }); }); });

php - Delete multiple rows from mysql database -

i want delete multiple rows mysql database using php code code have message error how solve ? you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'on' @ line 1 $files_query=mysqli_query($conn,"select * tbl_files db_isdeleted='1'")or die(mysqli_error($conn)); if(mysqli_num_rows($files_query)>0){ echo"<table class='table table-hover table-responsive table-bordered'><tr>"; echo"<td style='background:#f7ac01;font-size:16px;text-align: center;'><input type='checkbox' class='allcb' data-child='chk'/></td> <td style='background:#f7ac01;font-size:16px;text-align: center;'>filename</td> <td style='background:#f7ac01;font-size:16px;text-align: center;'>date</td>"; echo"</tr>"; whi

python - Decode text encoded with RSA -

i have rsa public/private key pair , passphrase. trying decode text encrypted using using above key(s). encoded text 512 chars long alpha-num string. i have tried using code provided @ sof question decrypt using rsa public key pycrypto first used private key encoded aes-256-cbc pem file. start of privkey.pem made me think aes-256 encrypted -----begin rsa private key----- proc-type: 4,encrypted dek-info: aes-256-cbc <rest of data> -----end rsa private key----- but received following error message. valueerror: pem encryption format not supported. so asked source private key without aes encryption gave me. using key decrypted works , decrypted text looks below (i showing of text) b'\x93\n(\x92\x02\x9af*?\x18"\x19\x12gn\xc2\<rest of text>' this not plain text. doing wrong? can me decode text. edit 1: based on maarten's answer below, have tried following code still getting errors. here code decryption from crypto.cipher import pkcs1_

php - Uploading files in CodeIgniter -

i have project based on codeignitor , im facing problem uploading forms cant attach more 1 files have upload fields attach user profile picture im trying duplacate filed attach 2 or more files no chance . note changes in mvc files dublicated fields . here field code <?php if(isset($image)) echo "<div class='form-group has-error' >"; else echo "<div class='form-group' >"; ?> <label for="qr" class="col-sm-2 control-label col-xs-8 col-md-2"> <?=$this->lang->line("student_passport_pic")?> </label> <div class="col-sm-4 col-xs-6 col-md-4"> <input class="form-control" id="uploadfile" placeholder="choose file" di

c# - Passing Glass Model in sitecore view rendering -

we have 2 glass views inherited different glass models, both working great individually. now, want insert 1 view another. tried using code below: var model = new sitecorecontext().getitem<iourglassmodel>(path); if (model != null) { @html.sitecore().viewrendering("/views/path/banner.cshtml", new { model = model }) } this ended below error message: server error in '/' application. not locate item containing model definition. model path: castle.proxies.iourglassmodelproxy_1 let me know if need full stack trace. any suggestions appreciated. use insted: @html.partial("/views/path/banner.cshtml", model) the point @html.sitecore().viewrendering re-invoke sitecore pipelines , render component begging. on other side, using @html.partial render partial view using same execution. check question more details difference between 2 methods: sitecore view rendering , controller rendering helper

reactjs - how to make an observable in react with other library -

i have component return <textinput /> import other library. textinput has onchange prop take function function(value) { // value} .so how can make observable value , use observable anywhere? import textinput 'otherlibrary'; import rx 'rxjs/rx'; export default class mycomponent extends purecomponent { handletextchange = (value) => { this.observable = rx.observable.from(value).do(() => console.log(value)) // how make observable `value`? if make this, every time input letter in textinput make new observable, that's not correct. } render() { return ( <textinput defaultvalue="" onchange={this.handletextchange} /> ); } } if component react compoment, in onchange store in component's state using this.setstate({textinputvalue: value}) (to correct need change onchange callback follow

Convert a capital case string to camel case using shell script -

i trying convert capital case word camel case using shell script. e.g. projectassignment should converted projectassignment . echo "project assignment" | sed 's/.*/\l&/; s/[a-z]*/\u&/g' this produces output : project assignment on similar lines, want convert projectassignment projectassignment . you can gnu-sed: s='projectassignment' echo "$s" | sed 's/^[a-z]/\l&/' projectassignment ^[a-z] match first letter if uppercase.

asp.net core - How to change default name of OpenID Connect middleware (nonce and correlation) cookies -

i'm using 2 asp.net core middlewares openid connect , cookie authentication below: app.usecookieauthentication(new cookieauthenticationoptions { authenticationscheme = "cookie", cookiename = "clientcookiename", cookiehttponly = true, cookiesecure = _hostingenvironment.isdevelopment() ? cookiesecurepolicy.sameasrequest : cookiesecurepolicy.always, automaticauthenticate = true, automaticchallenge = false, expiretimespan = timespan.fromminutes(60) }); var oidcoptions = new openidconnectoptions { authenticationscheme = "oidc", signinscheme = "cookie", ... }; app.useopenidconnectauthentication(oidcoptions); during login in web application results in default cookies related nonce , correlation (exported browser developer tools): { "domain": "localhost", "expirationdate": 1478762475.872038, "hostonly": true, "httponly"

java - How to create independent JPanel-Layers within JFrame and repaint each indiviually -

i'm searching way paint several jcomponents above each other (overlap) , still being able individually access , alter them. e.g. paint 3 jpanels transparent backgrounds - each containing circle, rectangle or line. afterwards, i'd change appearance of circle. other 2 should not repainted (similarly layers in photoshop). my current project has jpanel thousands of lines , need change rectangle in on mouseover if redraw complete jpanel each time laggy. is there decent way accomplish that? thank ideas! i need change rectangle in you can invoke: panel.repaint(rectangle); // or panel.repaint(x, y, width, height); to specify rectangular area repainted.

console - Is there any way to change the colour of a string within a string in c++ -

this code, have string called battlelogs stores result of battles take place in turn, factionfighter name of attacker , factiondefender name of defending faction, there 14 total factions , set 1 of prior fight, of works problem each faction has own colour, , want have text show colour of faction on name. so if rebels grey , bandit horde green, display word rebels in grey , bandit horde in green, know how change colour of text put out cout, strings within strings don't know how it. battlelogs += factionfighter + " attempted raid lands of " + factiondefender + " unsuccessful\n"; any appreciated

apache spark - When to call `.value` for broadcasts in Pyspark? -

is 1 of following sub-optimal? ## first version ## def myfunc(val, listparam): return val in listparam.value # .value in function mylist_bc = sc.broadcast(mylist) rdd.map(lambda val:myfunc(val, mylist_bc)) ## second version ## def myfunc(val, listparam): return val in listparam mylist_bc = sc.broadcast(mylist) rdd.map(lambda val:myfunc(val, mylist_bc.value)) # .value outside function is ok use second version broadcast function unaware of i'm using broadcasted value? thought maybe interfere broadcasting. http://spark.apache.org/docs/latest/programming-guide.html#broadcast-variables after broadcast variable created, should used instead of value v in functions run on cluster v not shipped nodes more once i'd use option #1 - know executor use broadcast variable option #2 might problematic , if value of broadcast variable calculated on driver, , sent regular variable executors

mysql - Inserting multiple rows linked by fk - php -

i'm trying insert data form table teams, team names , fk each age group. i'm getting age group id simple select function , looping id's on form. when run insert function, i'm getting 4 rows first form data. if there 3,4 or 5 different age groups, insert names , age_group fk alle groups the form , age group loop: <form action="" method="post"> <?php $ages = get_age_groups_in_cups($db); foreach($ages $age){ ?> <input type="text" name="age_group[]" value="<?php echo $age['age_id'];?>"> <input type="text" name="team_name[]"> <input type="text" name="team_name[]"> <input type="text" name="team_name[]"> <input type="text" name="team_name[]"> <?php } ?> <button name="insert_rows">save</button> </form>

javascript - How to read AngularJs locale file? -

Image
i using angular bootstrap datepicker popup , want set date format of textbox according locale, idea reading property "shortdate" locale file , set in format property. so question is, how can read locale file? file present, localization working , can see file in network tab of browser's developer tools i once had same requirement , end using 'tmh.dynamiclocale' module ( see here . using module, you'll first have configure locale provider. in angular config function, inject 'tmhdynamiclocaleprovider' , call localelocationpattern( ) function define pattern use access locale files. for instance: tmhdynamiclocaleprovider.localelocationpattern('vendor/angular/locale/angular-locale_{{locale}}-{{locale}}.js'); then, whenever locale supposed changed, have inject 'tmhdynamiclocale' in service/controller/... , call set( ) function on in, passing argument, locale want switch to. hope that'll you.

node.js - npm Package.json not update devDependencies -

i using npm version 3.10.9 when run following command project root, installs in package.json not upadeted devdependencies. can manual. or other solution. npm material-design-lite --save-dev after install package.json "dependencies": { "@angular/common": "~2.1.1", "@angular/compiler": "~2.1.1", "@angular/core": "~2.1.1", "@angular/forms": "~2.1.1", "@angular/http": "~2.1.1", "@angular/platform-browser": "~2.1.1", "@angular/platform-browser-dynamic": "~2.1.1", "@angular/router": "~3.1.1", "@angular/upgrade": "~2.1.1", "angular-in-memory-web-api": "~0.1.13", "core-js": "^2.4.1", "reflect-metadata": "^0.1.8", "rxjs": "5.0.0-beta.12", "systemjs": &

caffe - CaffeonSpark build Error -

i trying caffeonspark running locally , have compiled , ran caffe successfully, have installed opencv, failed @ compiling caffeonspark. the whole error stack when make build is: [info] 60 errors [info] ------------------------------------------------------------- [info] ------------------------------------------------------------------------ [info] reactor summary: [info] [info] caffe .............................................. success [ 0.009 s] [info] caffe-distri ....................................... failure [ 16.940 s] [info] caffe-grid ......................................... skipped [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 18.841 s [info] finished at: 2016-11-11t03:50:31+08:00 [info] final memory: 14m/92m [info] ------------------------------------------------------------------------ [error] failed execute

connectiq - View nearby BLE devices -

i'd find ble devices within range of garmin connectiq enabled watch. is there anyway on garmin connectiq device (e.g. forerunner 235) scan nearby ble devices? there no way using existing watch api calls of connectiq sdk 2.2.1 released on november 8, 2016. instead have write companion mobile app (for android and/or ios) use find nearby devices. mobile app pass on whatever information needed , in turn carry out actions based on input watch. see more details on companions apps here: https://developer.garmin.com/connect-iq/programmers-guide/android-sdk-guide/ https://developer.garmin.com/connect-iq/programmers-guide/ios-sdk-guide/

c# - Alignment issues using ItemsStackPanel as ItemsPanel for a Univeral Windows ListView -

in universal windows project have listview (lvwteams) itemspanel have changed itemsstackpanel orientation == horizontal. itemtemplate of lvwteams listview (lvwplayers). works expected, except lvwplayers appears in middle. want appear @ top, listview occupying whole area given itemspanel. i had exact problem in wpf, , solved here alignment issues using stackpanel in listview.itemspanel . unfortunately, issue has reappeared since moving code universal windows project, wpf solution doesn't work. know how fix alignment issue? here example xaml shows problem: <grid x:name="root" background="{themeresource applicationpagebackgroundthemebrush}"> <grid.rowdefinitions> <rowdefinition height="*"/> </grid.rowdefinitions> <listview x:name="lvwteams" grid.row="0" verticalcontentalignment="stretch" horizontalcontentalignment="stretch"> <listviewitem

python - Pandas - Convert dictionary to dataframe - keys as columns -

i have folder .csv files contain timeseries in following format: 1 0.950861 2 2.34248 3 2.56038 4 3.46226 ... i access these textfiles looping on folder containing files , passing each textfile dictionary: data_dict = {textfile: pd.read_csv(textfile, header=3, delim_whitespace=true, index_col=0) textfile in textfiles} i want merge columns, contain data next each other dictionary keys index (pathname of textfiles). have same row number. so far tried passing dictionary pd.dataframe this: df = pd.dataframe.from_dict(data_dict, orient='index') actually, orientation needs default 'columns', results in error: value error: if using scalar values, must pass index if so, wrong result: excel_output this how pass frame excel: writer = pd.excelwriter("output.xls") df.to_excel(writer,'data', index_label = 'data', merge_cells =false) writer.save() i think error must in passing dictionary dataframe. tried pd.concat/merge/ap