Posts

Showing posts from February, 2015

python - Replace Numpy NaN with string in list with strings -

i have list containing string elements, , several nan numpy floats. e.g. l=['foo', 'bar', 'baz', 'nan'] how replace float nan string missing ? most answers found regard issue in pandas dataframe. try 1: for x in l: x=x.replace('nan', 'missing') gives attributeerror: 'float' object has no attribute 'replace' try 2: for x in l: if str(x)=='nan': x=str(x) command executes, nothing changes. advised comments: ['missing' if x 'nan' else x x in l] ['missing' if x np.isnan else x x in l] ['missing' if x np.nan else x x in l] commands execute, nothing changes. i think have bad format nan's (notice nan outputed nan , not 'nan'). answers comment should work: >>> import numpy np >>> l=['foo', 'bar', 'baz', np.nan] >>> print l ['foo', 'bar', 'baz', nan]

couchbase - N1QL: Using select directly on arrays -

i having problems on querying objects inside array. i have sample document { ... status: 'active', current: { ... }, history: [ { id: '73bae187-1101-4fb3-a71a-2bbf90026eb3', date: '2017-03-28t09:32:22.884z', content: 'this second content' }, { id: 'd6a6c63d-42db-4ef5-88e9-616cfe539a57', date: '2017-03-25t09:32:22.884z', content: 'this first content' }, { id: '3fbdb846-2b55-4ff8-8960-86997ef31556', schedule: '1970-01-01t00:00:00.000z', content: 'this old content' } ] } i want directly query history array sub document in want apply date filters. is possible in n1ql retrieve history array contain objects satisfies condition? can apply limit can control number of the returned objects inside array? i tried queries using splicing [0:$1] limit input doesn't work when limit greater array size. thanks hel

Odata trying to find out how it works -

i read odata still confusing me, me understand this? my question is: how can "buy" , manage? what need use? found test url's can example have on local computer ms sql server , access db odata in web app? thank tou

java - Hibernate: How to Map Composite Keys? -

i have table 3 composite keys. custom_id , patient_idpatient , service_provider_type_idservice_provider_type . current mapping below <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="beans.serviceprovider" table="service_provider" catalog="myglukose" optimistic-lock="version"> <id name="customid" type="string"> <column name="custom_id" not-null="true"/> </id> <many-to-one name="patient" class="beans.patient" fetch="select"> <column name="patient_idpatient" not-null="true"/> </many-to-one> <many-to-one name="serviceprov

swift - wondering use of computed property -

before. class drawingview: uiview { var arccenter = cgpoint(x: frame.midx, y: frame.midy) // error } after. class drawingview: uiview { var arccenter: cgpoint { return cgpoint(x: frame.midx, y: frame.midy) } } i know why error occur, can't understand why second codes not makes error. the first form not computed property. it stored property default value. it uses self causes error because @ moment default value going assigned instance not guaranteed instantiated. an alternative computed property – computed @ moment it's called – is lazy instantiated property. lazy var arccenter: cgpoint = cgpoint(x: self.frame.midx, y: self.frame.midy) unlike stored property default value assigned when property accessed first time.

python - getting a circular patch on every point on an Active Contour? -

i'm trying implement localized region-based segmentation given shawn-lankton. relies on local statistics of image rather global. so while localizing segmentation using active contours. specifies function b such circular patch around points of active contour. points within circular patch should 1, , exterior 0. how implement such patch , assign 1 inner region? the patch has updated once active contour evovles.

mysql - need a select query? count the number of id's which appear unique time? -

this question has answer here: mysql - count number of unique values 2 answers need select query should count cat_id table [output should 4][1] [1]: https://i.stack.imgur.com/caqmc.png output 4 select count (distinct cat_id) table_name

Spark: subset a few columns and remove null rows -

i running spark 2.1 on windows 10, have fetched data mysql spark using jdbc , table looks this x y z ------------------ 1 d1 null v ed 5 null null 7 s null null bd null i want create new spark dataset x , y columns above table , wan't keep rows not have null in either of 2 columns. resultant table should this x y -------- 1 7 s the following code: val load_df = spark.read.format("jdbc").option("url", "jdbc:mysql://100.150.200.250:3306").option("dbtable", "schema.table_name").option("user", "uname1").option("password", "pass1").load() val filter_df = load_df.select($"x".isnotnull,$"y".isnotnull).rdd // lets print first 5 values of filter_df filter_df.take(5) res0: array[org.apache.spark.sql.row] = array([true,true], [false,true], [true,false], [true,true], [false,true]) as shown, above re

Set Azure Reserved IP on cloud service via powershell -

Image
as said in title, can't assign ip cloud service. i've followed lot of forums , stackoverflow articles/posts i've still issue. when try run set-azurereservedipassociation -reservedipname primosguardo365reservedip -servicename primosguardo365 i error set-azurereservedipassociation : resourcenotfound: no deployments found. @ line:1 char:1 + set-azurereservedipassociation -reservedipname primosguardo365reserve ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : closeerror: (:) [set-azurereservedipassociation], cloudexception + fullyqualifiederrorid : microsoft.windowsazure.commands.servicemanagement.iaas.setazurereservedipassociationcmdlet but if try resources using same name λ get-azurereservedip reservedipname : group primosguardo365 primosguardo365reservedip address : **.**.**.** id : ****************** label : location : west europe s

pca - Determine number of factors in EFA (R) using Comparison Data -

i looking ways determine number of optimal factors in r factanal function. used method (conduct pca , use scree plot determine number of factors) known me. have found method described here easier non technical folks me. unfortunately r script no longer accessible in method implemented. wondering if there package available in r same? method proposed in study: determining number of factors retain in exploratory factor analysis using comparison data of known factorial structure . the r code moved here per author.

javascript - Why is this JQuery error happening? Animate is not a function -

i learning jquery , trying work way around scroll effect. anyway, trying make code work having trouble in doing so. breaks when runs animate function: i appreciate on one. thank you. uncaught typeerror: $(...).animate not function @ htmlanchorelement. (script.js:58) @ htmldocument.dispatch (jquery-3.1.1.slim.min.js:3) @ htmldocument.q.handle (jquery-3.1.1.slim.min.js:3) // select anchor tags click on $(document).on("click", "a", function(event) { console.log("item clicked"); // clear out default action event.preventdefault(); console.log("working until now"); // animate selected selected target $("html,body").animate({ scroll: $($(this).attr('href')).offset().top }, 900); console.log("no errors now"); }); <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-a7fzj7v+d/sdmmqp/noqwlilv

python - Check if substring is in string -

let's have list test = ["a","bb","ph","phi","phi_ph"] where member of test can either contain string ph , string phi , combination of these two, or none of them. how can filter list retain elements containing ph such that: test_filtered = ["ph","phi_ph"] when e.g. [x x in test if 'ph' in x] returns >> ["ph","phi","phi_ph"] the solution using re.compile() , re.search() functions: import re test = ["a","bb","ph","phi","phi_ph", "phi_abc", "ph_a"] search_str = 'ph' pattern = re.compile(r'(^|[^a-z0-9])'+ search_str + '([^a-z0-9]|$)') result = [i in test if re.search(pattern, i)] print(result) the output: ['ph', 'phi_ph', 'ph_a'] (^|[^a-z0-9]) - alternation group, ensures search string(i.e. ph ) should occur @ star

android - When do fcm refresh tokens created -

i'm new android , looking on firebase.in app multiple mobile numbers can logged in. doing deleting current token by firebaseinstanceid.getinstance().deleteinstanceid(); and after when log in new number, new token gets generated. so question in event triggers token regeneration event. 1 more thing above code line should have run on thread (other main thread) work this service used getting firebase token public class fcminstanceidlistenerservice extends firebaseinstanceidservice { appsharedpreferences appsharedpreferences; @override public void oncreate() { super.oncreate(); string currenttoken = firebaseinstanceid.getinstance().gettoken(); if (currenttoken!=null){ intent intent = new intent("device_id"); localbroadcastmanager.getinstance(this).sendbroadcast(intent); log.d("token", "refreshed token: " + currenttoken); appsharedpreferences.putstring(&q

c# - Can you help me with my code? -

using android.app; using android.widget; using android.os; using system; using android.content; using android.runtime; using android.views; using android.gms.maps; using android.gms.maps.model; using system.configuration; namespace googlemaps { [activity(label = "googlemaps", mainlauncher = true, icon = "@drawable/icon")] mainactivity public class mainactivity: activity, ionmapreadycallback { private googlemap gmap; protected override void oncreate(bundle bundle) { base.oncreate(bundle); // set our view "main" layout resource setcontentview(resource.layout.xmlfile1); setupmap(); } private void setupmap() { if (gmap == null) { mapfragment mapfragment = (mapfragment)fragmentmanager.findfragmentbyid(resource.id.map).getmapasync(this); } } public void onmapready(googl

xml - SAPUI5 / OpenUI5 - Load model from manifest -

i trying load northwind v4 odata service view. use tutorial @ https://openui5beta.hana.ondemand.com/#docs/guide/44062441f3bd4c67a4f665ae362d1109.html doesn't work there. declared model in manifest.json file , want display information in basic table. how should this? tried set model in controller, didnt work. this manifest.json. see, have declared model according developers guide { "_version": "1.1.0", "sap.app": { "_version": "1.1.0", "id": "sap.ui.demo.wt", "type": "application", "i18n": "i18n/i18n.properties", "title": "{{apptitle}}", "description": "{{appdescription}}", "applicationversion": { "version": "1.0.0" }, "datasources": { "invoiceremote": { "uri": "/destinations/northwind/v4/northwind/north

matlab - Checking variables in a time interval using Simulink -

so i'm wondering if use simulink blocks create sort of variable checker in interval; e.g. if number exceeds threshold of 0.5 more 3 times in interval of 5 seconds. are there blocks supporting kind of feature, or how 1 structure such thing?

javascript - Bootstrap 4 - Link to specific tab -

i have bootstrap 4 tabs set in wordpress website , want link specific tab page link: index.php: <a href="<?php echo get_site_url(); ?>/services/#innovation">discover more</a> services.php: <!-- nav tabs --> <ul class="nav nav-tabs text-xs-center" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#innovation" role="tab" aria-expanded="true"> <h4>innovation &<br/>investigation</h4> </a> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#electronic-engineering" role="tab" aria-expanded="false"> <h4>electronic<

May FILE be implemented as a function type in c? -

i see standard said file object type, what's object type in c? built-in type, struct, union , emun? fuction type kind of object type? can file * cast void * correctly? what's object type in c? built-in type, struct, union , emun? yes, plus other "intrinsic" types such mtx_t or atomic_flag is function type kind of object type? no, function types different, declared designated function declarations. functions can called using f(something) notation. object types invalid. can file * cast void * correctly? yes, pointer object types (that not const or volatile ) can converted void* , without loosing anything.

javascript - React - parent components render child components to different elements/nodes -

say have built site in plain old html+sass , want add little react in handle main content of site. have list of internal links in left col displays different content in right column (pretty tabs). looking @ various articles seems though should have parent component manages state (perhaps state.currenttab) control main content should rendered. my problem need parent component render left link , right content different elements. can't seem figure out how this. i can see below nothing render both of reactdom.render()'s in myparent never gets called. problem seem need call/render 2 left , right cols in there able pass state updates each 1 can control content. , don't think can if sit @ bottom of app.js file outside parent component. i'm sure i've made mistakes in below code explains enough want do. could please help? :d p.s may make little codepen if helps. so the project might so: index.html body .container #leftcol <!-- render links elem

Python Flask Base64 Images "Error: Incorrect padding" - only in safari -

Image
i resizing images drawing them canvas , getting data url. in python use data url decode image: content = form.dataurl_main.data.split(';')[1] image_encoded = content.split(',')[1] body = base64.decodestring(image_encoded.encode('utf-8')) it works absolutely fine in chrome , firefox, in safari error: 2017-03-28t11:33:39.293926+00:00 app[web.1]: return func(*args, **kwargs) 2017-03-28t11:33:39.293931+00:00 app[web.1]: body = base64.decodestring(image_encoded.encode('utf-8')) 2017-03-28t11:33:39.293933+00:00 app[web.1]: return binascii.a2b_base64(s) 2017-03-28t11:33:39.293933+00:00 app[web.1]: error: incorrect padding 2017-03-28t11:33:39.293932+00:00 app[web.1]: file "/app/.heroku/python/lib/python2.7/base64.py", line 328, in decodestring it seems fails correct dataurl, data url looks different if generated in safari, here js how create data url: my canvas , data url textfield: <canvas class="make-display-

concurrency - Synchronization using AKKA actors in scala -

i trying extend code in way inconsistency can occur , add functionality ensure consistency. allow localactor a1 read data remoteactor at localactor a1 perform modification send modification remoteactor (the update valid if there no change @ remoteactor) other localactor a2 can modify tree @ remoteactor possible inconsistency how should ensure when localactor have part of resource remoteactor (cxta of tree) should remain unchanged or locked no 1 else can modify it. how should approach problem? remoteactor code: class remoteactor extends actor { def receive = { case sendcontexta1() => this.synchronized{ println("from remote actor sender:"+sender+" tree part:"+remoteactor.rtree.cxta) sender ! rcvdcxta1(remoteactor.rtree.cxta) } case rcvdcxta1(cxta) => { println("1. recievecontexta1 before :" + remoteactor.rtree.cxta) remoteactor.rtree.cxta = cxta println("1.

jquery - How to change contents of div in .cshtml without reloading whole page in ASP.NET MVC 5 -

how change contents of div in .cshtml without reloading whole page in asp.net mvc 5 <div class="status-container" style="display:none"> <div class="status-block"> @if (model.dropdownlist.selectedvalue = 1) { <span class="status-title"> consultations : </span> } else { <span class="status-title"> sheduled : </span> } </div> </div> first time debug comes. not debug page further.. not reload again. you can use ajax , make call controller , data wanted change. sample code below. <script> $.ajax({ url: '/controllername/funname', //@url.action("funname","controllername") type: 'get', datatype: 'html', data: { selectedvalue: selectedvalue }, success: function (data) { //make function return partial view want fetched in data $('#dynamiccontent').html(data);

python - Pandas add variable as column and correspond to original table (but they have different length) -

Image
what ask kind of complicated title. made example show question. here sample table: df = pd.dataframe({'number': [1,2,3,4,5,6,7,8,9], 'col1':['a','b','c','d','e','f','g','h','i']}) next step extract df['number'] , run iteration reason. number= [i*i in df['number']] output [1, 4, 9, 16, 25, 36, 49, 64, 81] now have variable 'number' list. now key step have regroup list. let's number number less 40 number1 = [i in number if < 40] number2 = [i in number if > 40] ok, key step want add number1 , number2 df, expected final output this: that is, add new column 'type' , these 2 new variables have match index , content 'number1' , 'number2', not '1,4,9...81'. i think need numpy.where boolean mask : print (df.number.pow(2) < 40) 0 true 1 true 2 true 3 true 4 true 5 true 6 false 7

is it possible to make a system SMS Based Query in Java -

is possible make system sms based query in java?because im planning try , make system based on java has sms based query when send sort of code system replies sms yes, check out twilio. pretty great , can set cool chat bot type of thing either using web server or amazon lambda. can set script take inputs, whatever code want , send output. // install java helper library twilio.com/docs/java/install import com.twilio.twilio; import com.twilio.rest.api.v2010.account.message; import com.twilio.type.phonenumber; import java.net.urisyntaxexception; public class smssender { // find account sid , auth token @ twilio.com/console public static final string account_sid = "acxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static final string auth_token = "your_auth_token"; public static void main(string[] args) throws urisyntaxexception { twilio.init(account_sid, auth_token); message message = message .creator(new phonenumber("+14159352345

HTML form on an HTTPS site that submits its content to a completely different HTTPS site -

is possible/allowed create html form on https site submits content different (even domain different) https site or there issues, i.e. browser shows alert? it mixed content if have non ssl form action page @ secured page loaded on secure connection, contains form targets insecure endpoint. endpoint should made available on secure connection. makes warning on secured page

excel - How to Include Space in VBA Text file output -

how can include space part of output in vba? i have code below: celldata = "aaaaa" & space & "bbbbb" and want generate output below: "aaaaa" "bbbbb" but using code above, able generate: "aaaaa""bbbbb" well " " space so ?"aaaaa" & " " & "bbbbb" aaaaa bbbbb or if want quotes ?"""aaaaa""" & " " & """bbbbb"" "aaaaa" "bbbbb" which of course: ? """aaaaa"" ""bbbbb"" "aaaaa" "bbbbb" space if function name have not valid, could: "aaaaa" & space$(1) & "bbbbb" for single space.

html - Align sticky menu under normal menu -

i trying have 2 sticky headers. 1 menu , 1 should buy box of product. unfortuantely right buy button above menu, , need below. i have tried changing css position cannot seem work. have pointers on how can work? appreciated! link: https://www.agreenstory.de/shop/greenbook/greenbook-a4/ edit: situation i'd like: http://agreenstory.de/like.jpg the ideal thing modify javascript enforcing top: 0px use values according case scenario. but assume these third party plugins, can work-around applying following styles: #osplugin-header-sticky .header-fixed { padding-top: 65px; } .fusion-header-wrapper { z-index: 200001; } please let me know if gives desired result. black header still sticky-top right on top edge, while buy product call action appears (when scroll back) below it.

How to regain access to Google Cloud Storage project (Deleted all IAM users) -

i managed remove myself iam list of project. thought owner of organisation, able add myself or other users project. however seems project exists without being able manage it. seems bit strange, potentially live ghost project no 1 can use in way. does know if there super admin user of kind? thought was sort of admin created whole google cloud account , organisation, apparently not ...

layout - Wpf align content in different containers -

whats best way align controls vertically exist in different containers, in wpf/xaml? in case have several expander controls grid inside. in grid there labels , textboxes. grid row/column setup "auto" the expanders placed in maingrid in usercontrol it looks this: -expander--------------- | foo | barbarbarbar | | hello | hi | ------------------------ -expander2------------- | sometext | more text| | aaaaa | bbbbb | ----------------------- what tried describ above figure rows in different expanders aren't aligned (the "|" symbolizes grid border), , because column width set auto in grid. is there way align gridcolumn in different expanders without hardcoding width of columns in different grids? sharedsizegroup on grid here

c++ - Compiler flags for diagnosing slow compilation -

i have code compiles in ~6 seconds under g++ 4.8.5, takes extremely long time compile under icpc 17.0.1. 30 minutes, though haven't measured exactly. know why icpc taking long, cannot find flags or options might reveal me stage of compilation icpc stalling at. for g++ discovered nice option "-ftime-report", cannot find similar intel compilers. there anything? or there other way try , diagnose problem? edit: found problem via simple search of source files, commenting out , adding until found slowdown, still nice know if there flags or tools intel compilers sort of thing. for might curious or seeing similar, issue me had boost variadic macros using, suppose preprocessor has got in knot somehow. have attached culprit macro below. ugly, bit of automated debugging output. outer product doing 6x6 @ shouldn't serious burden (and g++ handled no problem), seems have somehow broken intel preprocessor. #define get_m2_matrix_el(r, product)

html - Wordpress image details - enable link title attribute -

Image
since 'title' attribute global attribute, use setting link title attribute <a> tag wordpress image details gui. i want able fetch title picture title in gallery this: https://jsfiddle.net/4o39j2xj/ i don't think possible use content: attr(title); <img> tag because closing tag, , :after part won't work same way <a> tag (correct me if wrong). is there function enable link title attribute option in wordpress image detailis?

amazon web services - Creating S3 Files in a Loop - Node.JS + AWS-SDK -

i'm trying create set of files binary data received api call files never created, promise.then function called: for(var in filesections){ var content = filesections[i].split((/content-length: [0-9]*/)); var filename = content[0].split('filename=')[1].trim(); var file = {bucket : 'mybucket', key: root+'/'+folder+'/'+subfolder+'/'+filename, body: content[1]}; console.log('creating file: '+file.key ); ***code runs @ least here each file*** promises.push(s3.upload(file)); } ***.then function fires*** promise.all(promises).then(confirmproposal()).catch(function(err){context.done(err);}); earlier on in process create file in s3 using code: var application = {bucket : 'mybucket', key: root+'/'+folder+'/'+subfolder+'/application.xml', body: filesections[0]}; s3.upload(application,function(err,data) { ...files created in here on successful response ... }); which wo

javascript - webpack: commonchunksplugin with webworker and multiple chunks -

i work on legacy application that, now, have split in specific way: simplified case : have 4 modules: //modulea.js export const modulea = ['modulea']; //moduleb.js import {modulea} './modulea'; export const moduleb = ['moduleb'].concat(modulea); //modulec.js import {modulea} './modulea'; import {moduleb} './moduleb'; export const modulec = ['modulec'].concat(modulea).concat(moduleb); //webworkermodule.js import {moduleb} './moduleb'; import {modulea} './modulea'; console.log("webworker module", modulea, moduleb); what need have output of 5 files: manifest.js contain common runtime of webpack modulea.js contains code of modulea moduleb.js contains code of moduleb modulec.js contains code of modulec webworkermodule.js contains code of module , module b , webpack runtime i tried multiple configuration, cannot obtain want. const path = require('path'); const webpack = require(&

c - Reading integers with commas between them -

i assumed using strtok best because of formatting of input. i've run few problems when trying detect errors: an example of line program read: .data 123,456,89 .data 12, 34, 53 , 64 these ok. my problem when input incorrect, example: .data 200 4000 // no comma speration .data 1, ,3 // ,3 should error .data 4, // , should error .data 12.2 // .2 should error , on my code (size buffer size = 30, valid_num goes through token see if chars numbers), idea first check validity of tokens , add them buffer, if numbers valid, add numbers data base: while((sptr = strtok(null, ", \t\n")) != null){ //this after reading using strtok before. if(i < size && valid_num(sptr)){ //buffer not full , token contains numbers temp_num = atoi(sptr); if(temp_num >= min_val && temp_num <= max_val){ //number within required size buffer[i] = temp_num; /*fill buffer*/ i++; } else{

Exporting a trained TensorFlow models to C++ in windows -

i want use trained tensorflow model validation\test in visual studio c++ project, windows 7 environment. theoretically, guess there 2 options seems reasonable me: indirect option: build exe or dll file warping python trained model (graph , weights) , run files within c++ visual studio project direct option: inlcude directly tensorflow libs in vs , import trained model can't find documentation or examples how in windows. suggestions best way it? the configuration have is: windows 7\10 tensorflow 1.0.1 python 3.5.2 visual studio 2015

javascript - How can I convert a subtree of the DOM into a DocumentFragment? -

i'm trying "keep" subtree of dom later use , reappending based on user action (a subtree created , manipulated using documentfragment , appended dom), don't want append , hide somewhere in dom, because further (and heavy in case) manipulation on slower , incurs layout reflows , further performance impact. is there cross-browser way (ie11+ care) convert dom subtree documentfragment? didnt' find yet searching or docs. thank you i'd suggest keep nodes you're interested in in array. it's more handy documentfragment, , not nasty nodelist or htmlcollection. a little utility convert "things" documentfragments. function fragmentflush(state){ if(state.text){ state.fragment.appendchild(document.createtextnode(state.text)); state.text = ""; } return state.fragment; } function fragmentiterate(state, value){ if( value instanceof node ){ fragmentflush(state).appendchild(value); }el

Spring Boot OAuth2 Single Sign Off -

i'm considering use oauth2 application. architecture i'm trying implement follows: i have own (and this) authorization server some resource apps validating access resources using authorization server some client apps (web, mobile) redirect user authorization server authentication , on success consume api's on resource apps. so far have managed implement interaction between 3 basic apps (1 auth server, 1 resource server , 1 client). thing don't working logout functionality. have read of "notoriously tricky problem" dave syer describes in tutorial, in case need user re-login after loging out. have tried giving few seconds access token , refresh token, instead of being prompted login again when expiration arrives, i'm getting npe on client app. have tried solutions proposed in post remove token token store, doesn't work. single sign off me desirable behaviour implementation. how can achieve using spring boot oauth2. if not possible reason, a

interop - C# CultureInfo ignoring impersonation -

i want cultureinfo used user (that not logged on). thought use impersonation described in question , cultureinfo seems ignore impersonation. if windowsidentity.getcurrent().name) name of non-logged-on user, if cultureinfo.currentculture culture of user starting application instead! how can cultureinfo user? i looked @ getuserdefaultlocalename in windows apis, i'm not familiar enough interop never working, , couldn't find online examples on how use c#. don't know if method work or if experience same issue.

Can I create a Date object from a predefined string (typescript)? -

i have value returned in string (numbers separated commas) , i'd make date object out of it. looks not possible, can confirm and/or suggest me solution. not work : let datestring='2017,3,22,0'; let datefromstring = new date(datestring); this works though (when pass list of numbers) : let datefromstring = new date(2017,3,22,0); and works : let datestring = '2008/05/10 12:08:20'; let datefromstring = new date(datestring); the goal create date object uniform string. possible ? can create date object predefined string, has 1 type of separator (comma, colon, slash or whatever) ? if environment compatible es6 (eg. babel, typescript, modern chrome/firefox etc), can use string's .split(',') , decompose array arguments following: const datestring = '2017,3,22,0'; const date = new date(...datestring.split(',')); // date object 2017/03/22 es5 compatible version: var datestring = '2017,1,2,0'; var date =

calling two jQuery function, onChange -

hi calling remotefunction in onchange event. want when user select parent dropdown, child dropdown belong parent id display default child block hidden. how call 2 function in onchange event. my code: <g:select optionkey="id" from="${commonlist}" class="fullborderbox" value="${value?."${propertyname}"?."${commonpropertyname}"?.id}" name="${commonpropertyname}.id" noselection="${['null': message(code: 'common.list.select')]}" onchange="${remotefunction( controller: 'middlewaredata', action: 'populateversion', params: "'typeid=' + this.value + '&&lookupproperty=' + '${commonpropertyname}'", update: "populateswversion${dataindex}" )}; $("#versionblock${dataindex}").hide();"/> <sp

php - TYPO3 Powermail - upload form - file has to be overwritten if a file with same name already exists -

i using powermail extension create form upload of several file types. form located in login area. every logged in user there folder name created uploaded files stored. # personal storage folder logged in user lib.userfolder = text lib.userfolder { data = tsfe:fe_user|user|username wrap = fileadmin/user_upload/|/ required = 1 } # powermail file upload settings plugin.tx_powermail.settings.setup.misc.file { folder = fileadmin/user_upload/ size = {$plugin.tx_powermail.settings.misc.uploadsize} extension = {$plugin.tx_powermail.settings.misc.uploadfileextensions} randomizefilename = {$plugin.tx_powermail.settings.misc.randomizefilename} } this works fine far. problem if file name "example.pdf" exists , file named "example.pdf" uploaded file not overwritten. instead uploaded file "example.pdf" renamed "example_01.pdf". behaviour in general not fitting needs. need approach handle problem nice hints here. to keep old files defaul

html5 - code to edit jmeter jmx file in html -

i working on application want open jmeter test plan (.jmx file) in html5 page can opened/edited in web browser. please guide me best approach , technologies use. considering javascript , jquery purpose. any suggestion or guidance great help. thanks my first idea online xml editor must exist. open url , place file on load url work on xml nodes , save later result on button download. complete example here http://codebeautify.org/xmlviewer/cbf7710f the other idea had load xml on jquery mentioned. place content on textbox , edit it. after copy-paste editor , save it. use example http://www.jquerybyexample.net/2012/04/read-and-process-xml-using-jquery-ajax.html

Facebook API Private Message image expired - How to get new image ? URL signature expired -

i'm helping maintain app integrates facebook, , has lots of archived links old private message images. these images expire, , go facebook , request new image. works 90% of time. about 10% of time we're getting response can't tell new image is. what's proper way request new url expired facebook private message image, preferably using v2.5 or newer of graph api? currently we're doing request facebook's graph api using message id of private message so: https://graph.facebook.com/v2.3/m_mid.xxxxxxxxx:yyyyyyyyy and gives response has bunch of attachments in it. 90% of use cases, there's new attachment has url or name field new filename contains old filename, e.g. old file name being xxx, we'd see new filename ....xxxx.... in url field. attachments [url='*%s*']/image_data/url attachments [name='*%s*']/image_data/url or sometimes picture but doesnt match now, bunch of attachments no way map new image. we haven&

windows - Determine who has a file open using C# - is there a way now? -

i need able check has file open using c#. found few people asked question before long time ago latest being in 2012. wondering if, in last 5 years, has microsoft added ability .net or maybe came out nuget package capable. here latest answer found you can use windows internal function ntquerysysteminformation undocumented parameter systemhandleinformation it. don't know c# implementation, know delphy code it, , vb6 code. check links, make c# implementation. delphi - files opened application https://forum.sysinternals.com/topic14546.html

c# - I want to Insert RadioButton Value in SQL Database using Classes -

i created class name employeedata write code here , want insert radiobutton value in sql database public static void addemployee(employee employee) { string connstring = configurationmanager.connectionstrings["employee"].connectionstring; sqlconnection conn = new sqlconnection(connstring); using (conn) { sqlcommand cmd = new sqlcommand("addemployee", conn); cmd.commandtype = commandtype.storedprocedure; cmd.parameters.add("@name", sqldbtype.nvarchar, 50).value = employee.name; cmd.parameters.add("@fname", sqldbtype.nvarchar, 50).value = employee.fname; cmd.parameters.add("@address", sqldbtype.nvarchar, 50).value = employee.address; cmd.parameters.add("@email", sqldbtype.nvarchar, 50).value = employee.email; cmd.parameters.add("@mobi

java - How to store and retrieve List<MyClass> object using RxPreferences -

i’m using gsonpreferenceadapter shown here prateek's rxpreferences library. my fragment class code: @inject rxsharedpreferences sharedpreferences; @inject gson gson; list<myclass> my_class_list; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // binding , inject go here. class listtype = new typetoken<arraylist<myclass>>(){}.getclass(); gsonpreferenceadapter<list<myclass>> adapter = new gsonpreferenceadapter<>(gson, listtype, new arraylist<myclass>(), gsonpreferenceadapter.syntaxexceptionbehavior.null); my_class_list = sharedpreferences.getobject("pref_myclass", new arraylist<>(), adapter).get(); if(my_class_list == null) timber.i("tis null."); timber.i("printing myclass items..."); for(myclass item: my_class_list) timber.i("myclass: " + item); } @onclick(r.id.add) public v

php - update database field on submit -

when admin ticks row or more in table , clicks on approve button, row data (request_id primary key) should updated in database field is_approved , should change 'pending' 'approved' is_approved field has 2 enum: pending , approved. how can this? <form action = "admin.php" method = "post"> <input type="button" name="accept" value="accept" /> <input type="hidden" name="submitted" value="true" /> </form> php code: if(!empty($_post['accept'])) { $request_id = $_post['request_id']; foreach($request_id $is_approved) { $query = mysql_query("update request set is_approved = 'approved' is_approved =$request_id"); } } change form as: <form action = "admin.php" method = "post"> <input type="button" name="accept" value="accept" />

swift - Crash casting WKNSURLRequest as? other type -

i'm getting hard crash when try cast wknsurlrequest (and other classes, webkit framework). e.g. in playground: import uikit import webkit final class sigh: nsobject { } nsclassfromstring("nsobject") as? sigh.type nsclassfromstring("wknsurlrequest") as? sigh.type the cast nsobject works (i.e. returns nil ), cast wknsurlrequest crashes exc_bad_access - have assumed return nil well. anyone got ideas might causing this? wknsurlrequest not inherit nsobject @interface wknsurlrequest : wkobject <nscopying> and wkobject root class: ns_root_class @interface wkobject <wkobject> unlike java, classes must inerhit object , obj-c not require classes inherit nsobject . the swift<->obj-c bridge has explicit support nsobject , subclasses, i'm not sure can handle other root objects equally well. on export side (swift classes being exposed obj-c) it's not possible make own root class. swift class shall exposed obj-c

javascript - Google Maps API marker move on scroll and layout style -

Image
i'm new in google maps api, trying embed marker address on google maps have errors. https://developers.google.com/maps/documentation/javascript/adding-a-google-map#map i'm using documentation , have copied code doesn't work because when scroll marker it's not fixed in map move , doesn't stay in correct place. also, buttons in left corner map , satellite doesn't appear properly, appear background line in whole map , don't smaller. finally, + , - button doesn't appear. someone tell me why have problem? here code: <script> function initmap() { var blitz8 = {lat: 45.806510, lng: 10.109520}; var map = new google.maps.map(document.getelementbyid("map"), { zoom: 18, center: blitz8 }); var marker = new google.maps.marker({ position: blitz8, map: map }); }; </script> and here live page: https://sebalaini.github.io/blitz8/ hi resolve problem disabled css option in base.scss please check , fix that,

drawing - How do I draw a simple stickman with javascript? -

function setup(){ = 5; } function draw(){ background(0,0,0); if (a == 5) { fill(255,255,255); ellipse(250,150,100,100); fill(255,255,255); rect(245,199,10,160); fill(255,255,255); rect(150,199,200,10); } if (a == 6) { fill(250,189,65); ellipse(250,250,100,100); fill(178,102,255); ellipse(250,250,500,100); } } function keytyped() { = 5; } if (key == 'f') { = 6; } } ^ above javascript (sketch.js), html <!doctype html> <html> <head> <body> </body> </html> this have far, , it's showing head, arms , body, can't find way make diagonal lines / or arc legs edit: pasted full code- i'm looking find simplest approach creating arched line? you can try this: function setup(){ createcanvas(500,500); // initialize a, assign value 5 = 5; } function draw(){ background(0

statistics - What it means for an algorithm to fit the Statistical Query model and PAC model in Machine Learning? -

statistical query (sq) learning model of kearns (1993) natural restriction of pac learning model in learning algorithm allowed obtain estimates of statistical properties of examples cannot see examples themselves. i know there lot of algorithms fit sq model, , lot of them can expressed sum on data points in order fit sq model, can parallelized using mapreduce etc. still, cannot grasp meaning of above definition... can please explain in own words?

"with" argument in scale() in R -

i'm trying understand how clusters in r. i'm following this blog post, don't understand argument with in code. head(water_data) v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 1: d-1/3/90 44101 1.5 7.8 182 407 166 66.3 4.5 2110 7.9 197 228 70.2 5.5 2120 7.9 119 280 2: d-2/3/90 39024 3.0 7.7 182 443 214 69.2 6.5 2660 7.7 197 244 75.4 7.7 2570 7.6 119 474 3: d-4/3/90 32229 5.0 7.6 182 528 186 69.9 3.4 1666 7.7 197 220 72.7 4.5 1594 7.7 119 272 4: d-5/3/90 35023 3.5 7.9 205 588 192 65.6 4.5 2430 7.8 236 268 73.1 8.5 2280 7.8 158 376 5: d-6/3/90 36924 1.5 8.0 242 496 176 64.8 4.0 2110 7.9 197 236 57.6 4.5 2020 7.8 119 372 6: d-7/3/90 38572 3.0 7.8 202 372 186 68.8 4.5 1644 7.8 197 248 66.1 8.5 1762 7.7 150 460 v20 v21 v22 v23 v24 v25 v26 v27 v28 v29 v30 v31 v32 v33 v34 v35 v36 v37 v38 1: 94 72.3 0.3 2010 7.3 18 84 21 81.0 0.02 2000 39.6 58.8 95.5 85.4 70.0 90.2 79.4 87.3 2: 96 79.2 0.4 2700 7.5 18 91 17 9