Posts

Showing posts from June, 2015

swift - Google analytics not working on iOS 10 -

i'm had implemented google analysis , run app on 1 of ios devices. however, real time reporting still showing everything 0 . had setup google analysis below. appreciated if suggestion given. appdelegate.swift didfinishlaunchingwithoptions method : - guard let gai = gai.sharedinstance() else { assert(false, "google analytics not confiugured correctly.") } gai.tracker(withtrackingid: "ua-10317xxxx-1") // optional: automatically report uncaught exceptions. gai.trackuncaughtexceptions = true loginvc.swift viewwillappear method : - override func viewwillappear(_ animated: bool) { super.viewwillappear(animated) setuptracker() } loginvc.swift setuptracker() method : - private func setuptracker() { let name = "login vc" guard let tracker = gai.sharedinstance().defaulttracker else { return } tracker.set(kgaiscreenname, value: name) guard let builder = gaidictionarybuilder.createscreenview(

authentication - airflow with OpenLDAP - LDAPAttributeError('invalid attribute type ' + attribute_name_to_check) LDAPAttributeError: invalid attribute type memberOf -

trying authenticate localsetup of airflow local openldap. while trying login webserver getting following error: file "/usr/local/lib/python2.7/dist-packages/ldap3/core/connection.py", line 751, in search raise ldapattributeerror('invalid attribute type ' + attribute_name_to_check) ldapattributeerror: invalid attribute type memberof error indicates memberof invalid attribute type. ldap section configuration is: superuser_filter = memberof=cn=airflow-super-users,ou=groups,dc=example,dc=com data_profiler_filter = memberof=cn=airflow-data-profilers,ou=groups,dc=example,dc=com after search understood should have configured groups overley memberof attribute. can't redo setup getting functionality. there workaround? additionally there 1 python package (airflow-alt-ldap) can workaround. it's not working airflow 1.8.1 setup no. memberof feature of memberof overlay. nothing else.

HTML5 Video formats -

this question has answer here: html5 video formats - compatibility 1 answer i need add video website using html5 video tags. format video need in work cross browser desktop , mobile. there lots of posts on stackoverflow, seem few years ago. there more date list ? looking @ list https://developer.mozilla.org/en-us/docs/web/html/supported_media_formats safe assume webm, ogg , mp4 enough ? thanks. video tag supports 3 formats: in html5, there 3 supported video formats: mp4, webm, , ogg. you can find updated guide attributes available in w3schools: https://www.w3schools.com/html/html5_video.asp

mysql - SQL Group by column and column value? -

i have hiring table below: ------------------------------------------------------ | slot_id | hired_days | qty | amt | return | -----------|-------------|-------|-------|-----------| | 1 | 30 | 5 | 100 | 0 | | 1 | 30 | 15 | 300 | 0 | | 1 | 30 | 12 | 170 | 1 | | 1 | 25 | 13 | 180 | 0 | | 1 | 30 | 4 | 180 | 1 | | 2 | 30 | 15 | 300 | 0 | ------------------------------------------------------ i want result grouped slot_id , hired_days grouping should done return value of 0 rows. result table needs display grouped rows , return 1 data. there way sql? ------------------------------------------------------- | slot_id | hired_days | qty | amt | return | |----------|-------------|--------|-------|-----------| | 1 | 30 | 20 | 400 | 0 | | 1 | 25 |

Accessing Foursquare check-in counts of a venue by month using Foursquare APIs? -

Image
i have use check-in counts of venue location eg.statueofliberty month-wise(for every month jan,feb,...dec ) calculating location popularity.how acquire data(check-in counts of location) each month? we use operation of subtracting last day of jan's check-in @ statue of liberty last day of feb's checkins value of check-ins in feb using before , aftertimestamps foursquare apis endpoints.unable acquire data without being manager venue.is there way?

hibernate - Which is the more efficient way of updating data? -

there table named company_master having multiple rows each user_id. updating table , setting 1 of column false . which way preferred ? 1) getting list<companymaster> company_master table , setting status field , , updating object in loop 2) writing directly query query query= session.createquery("update companymaster set status=:status userid= :userid"); query.setparameterlist("status", false); query.setparameterlist("userid", 1); query.executeupdate(); if can, in case can , should, use writing directly query update or delete operation. don't have select records before , update them, it's slower direct update - select data don't need update / delete, don't need iterate in server side (as it's slower in performance in db side). might have case when need update big amount of records , in case select db in store in java memory, it's wasted memory comsuption.

java - Creating a static instance variable for return type -

i have game loop runs approximately @ 60 fps. in each iteration need call bunch of methods utility class physics. looks this public final class physics { private static final float g = 9.81f; private static vector2d var1 = new vector2d(); private physics() { } public static vector2d method1(param1, param2, param3) { /* * computations param1, param2 , param3, * assign result var1 */ return var1; } } what pros , cons of design pattern? use var1 helper instance variable did in above code because if put inside method1() following public static vector2d method1(param1, param2, param3) { vector2d var1 = new vector2d(); /* * computations param1, param2 , param3, * assign result var1 */ return var1; } every second 60 new objects of type vector2d , want avoid garbage collection. i try minimize variable scope (for readablility) unless there'

wordpress - get post_posts empty with ampersand in title -

i have tried below scenario, both getting empty results if post title have & () symbol, first way, $event_details = get_page_by_title($event_name, object, 'tribe_events'); second way, $event_name = html_entity_decode( $event_name ); $event_details = get_page_by_title($event_name, object, 'tribe_events'); third way, global $wpdb; $search = $wpdb->query( "select * `wp_posts` `enter code here`post_title=".$title ); fourth way, $event_name = addslashes ( $event_name ); $event_details = get_page_by_title($event_name, object, 'tribe_events'); just use esc_attr() title , try use esc_html() $search = $wpdb->query( "select * `wp_posts` `enter code here`post_title='".esc_attr($title)."'" );

java - Vaadin 8.1 RC1 TreeDataProvider, TreeData (getParent), HierarchicalQuery -

i'm trying te play treegrid @ vaadin 8.1 rc1. i'm trying migare hierarchicalcontainer treedataprovider. didn't idea of new hierarchial data stucture. need simple things: - possible id of item of hierarchical data? or new data not use ids? - is possible parent object of existed object. like treedata<myclass> mytreedata; myclass myobject; myclass parentitem = mytreedata.getparent(myobject) i've found deail related hierarchicalquery , "the parent node available in hierarchicalquery via getparent method, returns root level." no examples how use hierarchicalquery. at moment (vaadin 8.1.0) no such method. added proposal , can implementer @ future versions. can store hierarchical info @ bean class use treedata.

javascript - Change fields with jquery -

i'd change contact form fields jquery. that's normal code: <label for="avia_3_1">nome <abbr class="required" title="richiesto">*</abbr></label> that's jquery i'm using. have combobox, name of label should change based on user selected item. works, tag <abbr> disappear. //$.noconflict(); jquery( document ).ready(function( $ ) { $("#avia_1_1").change(function(){ switch($("#avia_1_1").val()){ case "privato": $("label[for='avia_3_1']").text("nome"); $("abbr[title='richiesto']").text("*"); break; case "azienda": $("label[for='avia_3_1']").text("ragione sociale"); $("abbr[title='richiesto']").text("*"); break; } }); }); you can use .html() instead of .text() .

dart - How to check the device OS version from Flutter? -

platform.operatingsystem tell whether you're running on android or ios. how can check version of device os running on? you can use platform channels task. in native use os specific code version , resend flutter. here example battery level

javascript - Drawing a covering rect on mouseover on a svg -

i mark area active highlighting new rect. function coverrect(el){ var x=el.x.animval.value; var y=el.y.animval.value; var width=el.width.animval.value; var height=el.height.animval.value; var svg = document.documentelement; var svgns = svg.namespaceuri; var rect = document.createelementns(svgns,'rect'); rect.setattribute('x',x); rect.setattribute('y',y); rect.setattribute('width',width); rect.setattribute('height',height); rect.setattribute('fill','yellow'); svg.appendchild(rect); } var el = document.getelementbyid('ef-vr1'); el.addeventlistener('mouseover', function(){ coverrect(el); }, false); the rect correctly displayed not on rect on pass mouse over. alter alpha of rect in order show below, , pass click being intercepted underlaying rect. i managed issue changing cursor.

string - How to deal with separator format in Swift 3 -

having great deal of trouble finding way (formating) remove comma , if no comma found leave is. what hoping achieve taking result of distance , displaying in label format is: 4589.163 instead of 4,589.163 if no comma separator found leave 479.996 my code: if tempdistancestring.contains(",") { let newstring = tempdistancestring.replacingoccurrences(of: ",", with: "") } i'm looking formatter if supportable requirement. any appreciated. swift 3.1 just replace occurrences of comma blank string. let astring = "4,589.163" let newstring = astring.replacingoccurrences(of: ",", with: "")

selenium webdriver - unable to make xpath <button ===class="btn btn-lg btn-primary btn-block" ng-click="SignUp();" type="submit">Sign in</button> -

hi unable make xpath , want click on sign in button . <button class="btn btn-lg btn-primary btn-block" ng-click="signup();" type="submit">sign in</button> i using //a[@text = 'sign in'] <button class="btn btn-lg btn-primary btn-block" ng-click="signup();" type="submit">sign in</button> your xpath should be: //button[text() = 'sign in'] @ used attributes, example: //button[@ng-click = 'signup();']

mysql - Python dictionary not storing all the rows in form of key value pair -

newbie in python. in below code fetching 4610 rows db , storing them in dictionary pattern. extracting rows till second last line of code , normalize() decimal values when printing len(sdivalues) 146. should 4600. #len(sdidata) = 4610rows fetched mysql db data in sdidata: ibesticker =data[1].strip() key = (data[0],ibesticker) if(data[3] != none): periodyear = datetime.datetime.strptime(data[3], "%y-%m-%d") val = float(data[10].normalize()) print val #returns 4600 values sdivalues[key] = [periodyear.year, val, periodyear.month] # wrong here guess print len(sdivalues) # 146 rows

How to create '.epub' extension file using php? -

i'm building web application should create '.epub' extension files text content exist on mysql database, fetch data mysql database unable create '.epub' file. there way create '.epub' file using php script. just specify content-type using header() , echo out content database: header('content-type: application/epub+zip'); echo $data; if need force browser download file, can use following: header('content-description: file transfer'); header('content-type: application/epub+zip'); header('content-disposition: attachment; filename="mybook.epub"'); echo $data;

c# - ContentLoadException in MonoGame -

i've been trying load texture in monogame using xamarin studio. code set below : #region using statements using system; using microsoft.xna.framework; using microsoft.xna.framework.graphics; using microsoft.xna.framework.storage; using microsoft.xna.framework.input; #endregion namespace testgame { /// <summary> /// main type game /// </summary> public class game1 : game { graphicsdevicemanager graphics; spritebatch spritebatch; //game world texture2d texture; vector2 position = new vector2(0,0); public game1 () { graphics = new graphicsdevicemanager (this); content.rootdirectory = "content"; graphics.isfullscreen = false; } /// <summary> /// allows game perform initialization needs before starting run. /// can query required services , load non-graphic /// related content.

my activemq plugin not work -

i write activemq plugin, not work. the code: package cn.ennwifi.mqttplugin; import org.apache.activemq.broker.broker; import org.apache.activemq.broker.brokerplugin; public class mqttplugin implements brokerplugin { public broker installplugin(broker broker) throws exception { return new mqttfilter(broker); } } package cn.ennwifi.mqttplugin; import org.apache.activemq.broker.broker; import org.apache.activemq.broker.brokerfilter; import org.apache.activemq.broker.connectioncontext; import org.apache.activemq.command.connectioninfo; public class mqttfilter extends brokerfilter { public mqttfilter(broker broker) { super(broker); system.out.println("mqtt插件"); } @override public void addconnection(connectioncontext context, connectioninfo info) throws exception { system.out.println("mqtt连接信息:" + info.getclientid()); if (info.getusername() != "123") { return; } super.addconnection(context, info); }

git - Team Foundation Server - set default repository for team -

Image
in tfs 2017, have big project multiple teams , areas within it, suggested in this blog post . i couldn't find out how set default git repository each of these teams, "code" menu item @ top point specific repository each team. no, cannot achieve that. have navigate manually if want switch repository 1 another. not auto-switch, no such relationship between team , repository in tfs/vsts. as workaround can add repositories reflect each team favorites , can switch corresponding repository conveniently my favorites in account hub.

javascript - how to filter nested array like this? -

i having response below let m = [ { name: 'summary', sublistexpanded: false, sublist: [ ] }, { name: 'upload', sublistexpanded: false, sublist: [ ] }, { name: 'tasks', sublistexpanded: false, sublist: [ ] }, { name: 'dashboard', sublistexpanded: false, sublist: [ ] }, { name: 'master', sublistexpanded: false, sublist: [ { id: 'user-master', name: 'user-master' }, { id: 'menu-master', name: 'menu-master' }, { id: 'entity-master', name: 'entity-master' }, { id: 'vendor-master', name: 'vendor-master' },

single sign on - (120440) Invalid relay state received in Authentication Response. Login has failed, please contact Site Administrator. Relay state received : null -

i trying test saml sso , have used sso circle idp part, getting error "(120440) invalid relay state received in authentication response. login has failed, please contact site administrator. relay state received : null". i trying figure how can pass relay state request?

java.util.scanner - How java.util.NoSuchElementException (basic program) -

java.util.nosuchelementexception problem... used 2 scanners scanbud() and scabudrad() the reason here: scanbudrad.close(); you using multiple instances of scanner, _but closes scanner, instance close under hood input stream shared between other remaining instances... after that, trying read /get scanner object inputstream closed throws exception.

Is it possible to bind an object elements according to the value of a variable in angularjs -

suppose have object this: var myobj = { item1:{}, item2:{}, item3:{}, ... }; i have variable (e.g: itemholder ) values item1 , item2 , on. i want bind object elements in view. there way bind according value of variable? solution below: {{myobj.[itemholder]}} assuming both variables declared on scope, yes, can using javascript bracket notation so: $scope.myobj = { item1: {}, item2: {}, item3: {}, ... }; $scope.itemholder = 'item1'; then can interpolate value below: {{ myobj[itemholder] }} // {} working snippet: angular.module('myapp', []) .controller('appcontroller', function($scope) { $scope.myobj = { item1: { a: 1 }, item2: { b: 2 }, item3: { c: 3 } }; $scope.itemholder = 'item1'; }); <div ng-app="myapp" ng-controller="appcontroller"> type prop name<br> <input type="text" ng-model=&quo

java - Should.I use listview or listactivity -

i have 3 images in view , want display list upon selecting of images. upon selecting image list shows adjacent image selected. 1 list can show @ time, if list visible next 1 image , image selected new list built next selected image , existing list disappears. the lists built using arrays. should use listview or listactivity. or might there better approach doing this. thanks, you can use recyclerview list mentioned problem

python - Parsing a JSON response from URL -

my requirement parse json response url response. json feed comprised of 2 list namely: a. "ownerships" - list contain 2 main attributes nodecode parentcode b. "nodes" - list consists of 2 attributes nodecode (nodecode primary identifier of each node) nodetype (nodetype can have values "level01", "level02" ,..., "level06") the logic is: for each nodecode value in "nodes" scan "ownerships" list related parentcode come "nodes" list , search parentcode obtained in earlier step nodecode, , corresponding "nodetype" repeat earlier steps till nodecodes parsed, @ end have below(all these columns single record): level01nodecode level02nodecode level03nodecode level04nodecode level05nodecode level06nodecode bottom line starting lowest level(assuming level01), scan nodes , ownerhips lists, nodecode corresponding level, , keep searching based on parentcode till top levels covered

Microsoft Graph Excel API - request not working with multiple ranges -

can access specific cell values multiple ranges using single microsoft graph request? for example: https://graph.microsoft.com/v1.0/me/drive/items/{file-id}/workbook/worksheets('{id}')/range(address='e10:e11,c58:c59') if request 1 range getting expected result. if use query above 2 specific ranges not working: "error": { "code": "invalidargument", "message": "the argument invalid or missing or has incorrect format.", "innererror": { "request-id": "1d3d0a3c-cf6f-4f0c-8e84-c65ff80cd020", "date": "2017-07-25t14:13:11" } } i suspect you're attempting use graph in same way vba can used refer multiple ranges (i.e. worksheets("sheet1").range("c5:d9,g9:h16,b14:d18") ). isn't model isn't supported graph. instead you'll need pull each range using separate get request: get workbo

javascript - Stuck in infinite redirect loop when http get an chunked response -

i'm trying body of following url https://extranet.ores.be/de/services/price-simulation using npm module request. thing , link, module doesn't work think. because continuously fail maxredirects reached error. have debuged think , yes because first call url response location header same url, infite loop. think , redirection doesn't seems problem firefox or chrome, ... browsers resolving correctly. missing ? or maybe proxy problem ? here parts of code : var proxiedrequest = request.defaults({proxy: "http://proxy.xxx.xxxxxxx.be:xxxx", maxredirects : 5}) proxiedrequest.get(that.buildrequest(url.url), (error, response, body) => { let html = null; let status = null; let failed = false; if (!error && response.statuscode === 200 && (response.headers['content-type'].includes('text/html') || response.headers['content-type'].includes('application/xhtml+xml'))){ html =

ios - How to reset root view controller -

is possible reset root view controller? reset mean resetting initial state viewdidload called again. i'm using uitabbarcontroller , when logout want tabs loaded unloaded. you can setting instance of tabbarcontroller rootviewcontroller on logout action. swift 3: let storyboard = uistoryboard(name: "main", bundle: nil) let tabbarcontroller = storyboard.instantiateviewcontroller(withidentifier: "tabbarcontroller") as! uitabbarcontroller uiapplication.shared.keywindow?.rootviewcontroller = tabbarcontroller uiapplication.shared.keywindow?.makekeyandvisible() objective c: uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; uitabbarcontroller *tabbarcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"tabbarcontroller"]; [[[uiapplication sharedapplication] keywindow] setrootviewcontroller:tabbarcontroller]; [[[uiapplication sharedapplication] keywindow] makekeyandvisible];

MATLAB - destroy listener after force quit ctrl+c -

i working on matlab script temperature acquisition ni device. use listener run callback function refreshing chart. when ctrl+c, main script stops following error: "undefined function 'wait' input arguments of type 'event.listener'.". problem listener still trigger events, chart keeps refreshing. i've tried catch try/catch , used oncleanup function delete listener, without success. can give me advices please? :) edit : here code s = daq.createsession('ni'); s.addanaloginputchannel('cdaq1mod1', 0, 'thermocouple'); s.rate = 7; s.durationinseconds = 5; s.channels.thermocoupletype = 't'; s.channels.units = 'celsius'; lh = addlistener(s,'dataavailable',@plotdata); ocu = oncleanup(@() delete(lh)); s.startbackground(); try wait(s); catch delete(lh); end to allow code respond gracefully ctrl + c , try attaching callback erroroccurred event stops session : ... errlistener = addli

java - Websphere 8.0.0.10 - EntityManager not injected (NullPointerException) -

in our application using 2 databases in 2 modules each own persistence.xml: persistence.xml first : <persistence-unit name="first-databasepu"> <mapping-file>meta-inf/dynamic_orm.xml</mapping-file> <class>some.class.using.first.asdf</class> .... <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.sqlserverdialect" /> <property name="hibernate.max_fetch_depth" value="3" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.default_batch_fetch_size" value="100" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.nocacheprovider" /> </properties> and similar second : <persistence-unit name="second-databasepu"> <mapping-file>meta-inf/dynamic_orm.xml</mapping-file> <class>so

elasticsearch - Using Mapping char filter with synonyms token filter does not work -

synonyms , my_char_filter works fine when used separately , synonyms stop working when use these 2 together. use elastic v 5.5 "analysis": { "analyzer": { "my_custom_analyzer": { "type": "custom", "tokenizer": "keyword", "filter": ["synonym"], "char_filter": ["my_char_filter"] } }, "filter" : { "synonym" : { "type" : "synonym", "synonyms" : [ "i-pod, pod => ipod", "universe, cosmos" ] } }, "char_filter": { "my_char_filter": { "type": "mapping", "mappings": [ "i => ı", "e => ə", "o =>

json - Compare value of JSONObject with boolean value -

i have jsonobject having key identified , value true or false(boolean). next time have check whether key true or false doing this: jsonobject eachcasejsonobject = new jsonobject(); eachcasejsonobject.put("json_is_identified", true); now want check value of key json_is_identified , doing : "true".equalsignorecase(eachcasejsonobject.get(json_is_identified).tostring()) but want boolean value directly using key json_is_identified , have check true or false. you can use: eachcasejsonobject.getboolean("json_is_identified")

android - Fragment webview back button not working -

at navigationdrawer menu , clicking search opens specific webview in fragment . works fine, when press on webview - instead of getting last visited webscreen comes main fragment . how can solve this? i'm providing fragment java file here. please mention other codes need (if needed) solve problem public class googlefragment extends fragment { public webview mwebview; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(fragment_google, container, false); mwebview = (webview) v.findviewbyid(webview); mwebview.loadurl("https://google.com"); // enable javascript websettings websettings = mwebview.getsettings(); websettings.setjavascriptenabled(true); //improve webview performance mwebview.getsettings().setrenderpriority(websettings.renderpriority.high); mwebview.getsettings().setcachemode(websettings.load_cache_else_

objective c - Conversion of programmatic UIView subclass to Nib-based UIView shows severe performance degradation -

i'm building app, shows lot (100-500) of small views in scrollpanel. these views have several images, text labels, etc. wanted have more declarative , intuitive designer of views , switched ui builder (xib/nib). experience 4x-10x slower performance on opening scene. recognized, if e.g. disable auto layout option uiview, loading accelerated @ least twice. still far slower, did before programmatically. can guess, using auto layout constraints making calculated on each instantiation. have tip, how identify bottleneck(s)?

android - Removing space between recyclerview items -

i have searched around , mention changing layout_height wrap_content mine in wrap_content . can't identify error. welcome. in advance! screenshot of problem <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" tools:context="com.fyp.ipptapp.ui.standardfragment"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <linearlayout android:id="@+id/test" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <linearlayout android:layout_width="wrap_content" android:layout_height="wr

Implementing Search filter in Android -

suppose showing list of movies. you offering filter (as separate activity) (filter window overlayed on top of list of movies (not sure how in android) now user selects filters in filter screen, , wants apply filter. the filter data should transfered filter activity previous activity (which shows movie lists). how can pass data in scenario? should use kind of event system (such notificationcenter in ios)? or should use form of startactivity though activity started , waiting. when want open particular activity result in previous activity , best practice according me use startactivityforresult(intent,requestcode) instead of startactivity(intent) . override following method 1st activity wish receive data onactivityresult(int requestcode, int resultcode, intent data) in order result on 1st activity, following code should triggered in 2nd activity intent resultintent = new intent(); resultintent.putextra("data", yourdata); //make '

django - Need to download 90MB+ xlsx file, cannot save it on the server. Can I stream it to a client -

i have django running on nginx webserver, uwsgi application server. need generate large .xlsx file combining multiple smaller ones. file needs downloaded client. after googling lot, have not been able find answers question, asking here. i using openpyxl writeonly worksheet. upon trying save worksheet process gets killed. my question is, whether can stream workbook client via uwsgi socket , save there. it appreciated if provide sample code implementation, can save or stream file client!

angular - ngrx store subscribe to change in item in collection -

i'm using latest angular 4 , @ngrx/store. let's have object: export interface layer { id: number; name: string; selected: boolean; data: any; } i have created component user can select or deselect layer. i'm trying use show , hide layers in mapbox-gl. selected property of layer object gets turned true or false. i created actions: export const show_layer = '[layers] show layer'; export const hide_layer = '[layers] hide layer'; export class showlayeraction implements action { readonly type = show_layer; constructor(public payload: number) { } } export class hidelayeraction implements action { readonly type = hide_layer; constructor(public payload: number) { } } export type actions = showlayeraction | hidelayeraction; i created reducer: export interface layersstate { ids: number[]; entities: { [id: number]: layer }; } const initialstate: layersstate = { ids: [ 1 ], entities: { 1: {

c# - 'SqlConnection' does not contain a constructor that takes 4 arguments -

this code: public void sqldbconnect() { sqlconnection conn = new sqlconnection("data source={0};user id={1};password={2};", server, user, password); conn.open(); } i try make connection via server name, user , pass. you need format string , pass string constructor (this c# 6 specific feature): sqlconnection conn = new sqlconnection($"data source={server};user id={user};password={password};"); or in older c# versions can use string.format : sqlconnection conn = new sqlconnection(string.format("data source={0};user id={1};password={2};", server, user, password));

python - Dataframe Boolean Logic Index Match -

i have created pandas data frame , filter data based on boolean logic. i'd closer excels' index match function simple filtering. have researched lot of other threads. when apply filter, data frame returns 0 true values. why 0 true values being returned when have been flexible logic? and; if introduced 5th column, column 'd' , random.randomint(100-1000,100) , logic use conditionally find maximum values column d ? i.e. can force data frame return highest true values column, in event multiple true values returned? advice appreciated. thank in advance. import pandas pd df = pd.dataframe({ 'step': [1,1,1,1,1,1,2,2,2,2,2,2], 'a': [4,5,6,7,4,5,6,7,4,5,6,7], 'b': [10,20,30,40,10,20,30,40,10,20,30,40], 'c': [0,0.5,1,1.5,2,2.5,0,0.5,1,1.5,2.0,2.5] }) columns = ['step','a','b','c'] df=df[columns] new_df=df[(df.step == 1) & (df.a == 4|5|6|7) & (df.b == 10|20|30|40)] new_df

python - How to put different in magnitude values at same distance on x-axis -

Image
i'm using python plot several straight lines on same plot. have great variability in values magnitude on x values (called variable q in code), want put them @ same distance on x-axis, in order have clear vision on first part of graph. here code: def c(m,x): ''' linear cost function, describing costs each weight range :param m: slope, modelling rates :param x: abscissa, modelling quantity ordered :return: cost value each quantity ''' return m * x in range(0,9): w = np.arange(0., q[9], 0.01) plt.plot(w,c(r[i],w),'b--',linewidth=0.3) plt.plot( [q[i],breakpoints[i]] , [c(r[i], q[i]), c(r[i], breakpoints[i])], 'r') plt.plot(q[i + 1], c(r[i], breakpoints[i]), 'r.') plt.show() for sake of simplicity, here there data involved in code snippet: as can see, classical quantity discount study. so, if plot these values, can't distinguish happening @ first straight lines, since little space reserved first q

html php mysql secure -

i use php manage html , have problem input date in mysql. input in mysql or update or delete in mysql ok how can make security input data in mysql because if 1 open see html source code browser can see predefined inputs , can change thats in html , after enter wronk inputs in mysql. this code: options value: <select name="extend"> <option value="<?php $_end1;$newdate = date('y-m-d', strtotime($_end. " + 1 month"));echo $newdate;?>">1 month</option> now when if open browser , see code can replease 1 month several month , in mysql. how can secure , or hide in html. thx if you're wanting have fields or input can't edited user, such current date form submitted on or along lines of that, need do of on server side (not client side). data submitted client side can (and should treat will) changed. instead of having form fields preset values, fields hidden, fields disabled, data render

JQ: maximum file path length (windows) -

i use jq (1.5) in windows 10 environment json transformation operation (to load data api sql server). checked yesterday new copy of jq transform command on test enviroment , run in morning in exception (jq command, source , destination files identical). different between old , new 1 filepath: old: c:\import\ new: c:\import\test20170725\ following command (in powershell) used: jq.exe -f c:\import\test20170725\jqfilter_cruises.jq c:\import\test20170725\dreamlines_cruises.json | out-file -encoding utf8 -filepath c:\import\test20170725\import_cruises.json i experimented today , looks path input files limited in maximum length. if reduce filepath there command works fine (like original one). tips? regards timo

scala - Spark dataframe select rows with at least one null or blank in any column of that row -

from 1 dataframe want create new dataframe @ least 1 value in of columns null or blank in spark 1.5 / scala. i trying write generalize function create new dataframe. pass dataframe , list of columns , creates record. thanks sample data : val df = seq((null, some(2)), (some("a"), some(4)), (some(""), some(5)), (some("b"), null)).todf("a", "b") df.show +----+----+ | a| b| +----+----+ |null| 2| | a| 4| | | 5| | b|null| +----+----+ you can construct condition as, assume blank means empty string here: import org.apache.spark.sql.functions.col val cond = df.columns.map(x => col(x).isnull || col(x) === "").reduce(_ || _) df.filter(cond).show +----+----+ | a| b| +----+----+ |null| 2| | | 5| | b|null| +----+----+

linux - How to create a git alias to recursively run a command on all submodules? -

i have following command run manually: $ git fetch --all && git reset --hard @{u} && git submodule foreach --recursive "git fetch --all && git reset --hard @{u}" i'm using git v2.13.0. goals are: run specified command on parent (current) repository first. execute same command on submodules, recursively. i tried create alias so: [alias] run = !f() { \"$@\" && git submodule foreach --recursive \"$@\"; }; f" which run (using earlier example): $ git run "git fetch --all && git reset --hard @{u}" however following error (with git trace enabled diagnostics): 09:38:31.170812 git.c:594 trace: exec: 'git-run' 'git fetch --all && git reset --hard @{u}' 09:38:31.170899 run-command.c:369 trace: run_command: 'git-run' 'git fetch --all && git reset --hard @{u}' 09:38:31.172819 run-command.c:369 trace: run_comma

swift - Change a button's characteristic outside class programatically -

in code below, want able change visibility of button in class, when try change button.ishidden false, button still doesn't show up. view controller 1: override viewdidload(){ button.ishidden = true } view controller 2: viewcontroller1().button.ishidden = false how can change button's visibility controller calling viewcontroller1() creates viewcontroller1 instance instead of working viewcontroller1 instance has been instantiated. to access properties (in case button) of viewcontroller1 viewcontroller2 , have pass reference button viewcontroller1 viewcontroller2 , change properties through reference. you need set reference in prepare(for segue) function in viewcontroller1 . override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "mysegue { let nextvc = segue.destination as! viewcontroller2 nextvc.button = sender as! uibutton } } you need set segue manual , call in

Mybatis-3.4.2 version of rowbounds can not implement paging -

mybatis-3.4.2 version of rowbounds can not implement paging. passing new rowbounds (0, 10) arguments method implemented, value of rowbounds becomes default when skiprows (rsw.getresultset (), rowbounds) method executed, , why? there solution?

hadoop - Pig script doesn't work with MapReduce -

i'm trying use hadoop , apache pig. have .txt file data , script .pig file script : student = load '/home/srv-hadoop/data.txt' using pigstorage(',') (id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray); student_order = order student firstname asc; dump student_order; and .txt file : 001,rajiv,reddy,21,9848022337,hyderabad 002,siddarth,battacharya,22,9848022338,kolkata 003,rajesh,khanna,22,9848022339,delhi 004,preethi,agarwal,21,9848022330,pune 005,trupthi,mohanthy,23,9848022336,bhuwaneshwar 006,archana,mishra,23,9848022335,chennai 007,komal,nayak,24,9848022334,trivendram 008,bharathi,nambiayar,24,9848022333,chennai but, when execute : pig -x mapreduce data.pig 17/07/25 17:04:59 info pig.exectypeprovider: trying exectype : local 17/07/25 17:04:59 info pig.exectypeprovider: trying exectype : mapreduce 17/07/25 17:04:59 info pig.exectypeprovider: picked mapreduce exectype 2017-07-25 17:04:59,399 [main] info org.apache.p

python - Is there a way to add arrows for nx. draw in networkx? -

Image
i using networkx in python , using nx.draw function takes in arrows=true parameter, arrows don't seem show up. when doing this, using g=nx.graph(), when use g = nx.digraph(), arrows show up, default network shape lost. there way preserve default network layout comes nx.draw , have arrows? yes, have fix positions yourself, see below example using circular_layout . import networkx nx import matplotlib.pyplot plt g = nx.erdos_renyi_graph(20, 0.2) pos = nx.circular_layout(g) nx.draw_networkx(g, pos=pos) plt.show() pos dictionary nodes keys , coordinates values. plot digraph (with same node set): g1 = nx.digraph(g) nx.draw_networkx(g1, pos=pos) plt.show()

java - unexpected char: '@' - Handling Pivots and Annotation with JpaRepository -

i test out sql queries using native sql, before bringing them spring jparespository files. i (with of @curiouskid) able perform pivot table (which displays data in "excel-friendly fashion) , separate endpoint. for brevity, display first few lines (which causing error): com.example.demo.repositories.salesrepository package com.example.demo.repositories; import java.util.list; import org.springframework.data.jpa.repository.jparepository; import org.springframework.data.jpa.repository.query; import org.springframework.stereotype.component; import com.bofa.app.entities.sales; @component public interface salesrepository extends jparepository<sales, long> { @query("declare " + "@cols nvarchar(max), " + "@convertcols nvarchar(max), " + "@query nvarchar(max), " ... note, have several other queries aren't using declare annotations (and simple queries) working fine within repository. declare keyword isn't

sql server - Return a column to notify row change of another column -

i have table: |----fruit----| |-------------| |--apples--| |--apples--| |--apples--| |--apples--| |-bananas-| |-bananas-| |-oranges-| |--plums---| |--plums---| i have below script: case when [fruit] = [fruit] '0' else [fruit] end what want return 2 columns. 1 fruit column , 2nd column shows when fruit column changes next fruit, have following:- |----fruit----||fruit change| |-------------||----------------| |--apples--||-------0-------| |--apples--||-------0-------| |--apples--||-------0-------| |--apples--||-------0-------| |-bananas-||--bananas--| |-bananas-||-------0-------| |-oranges-||---oranges---| |--plums---||----plums----| |--plums---||-------0-------| |--plums---||-------0-------| |--plums---||-------0-------| |--plums---||-------0-------| |--mango---||---mango---| |--mango---||-------0-------| how return column corresponding change in fruit script above doesn't allow me specify need do. you can use lag below: select fruit,case when frui

Create an Azure VM with an unmanaged disk -

i'm trying create azure vm unmanaged disk via powershell since managed disks aren't supported in azure government yet. none of documentation find powershell vm creation references managed or unmanaged disks , default seems managed disks. vm creation fails following error: new-azurermvm : managed disks not supported in region. errorcode: badrequest here's script i'm using: $location = "usgovtexas" new-azurermresourcegroup -name myresourcegroup -location $location # create subnet configuration $subnetconfig = new-azurermvirtualnetworksubnetconfig -name mysubnet -addressprefix 192.168.1.0/24 # create virtual network $vnet = new-azurermvirtualnetwork -resourcegroupname myresourcegroup -location $location ` -name myvnet -addressprefix 192.168.0.0/16 -subnet $subnetconfig # create public ip address , specify dns name $pip = new-azurermpublicipaddress -resourcegroupname myresourcegroup -location $location ` -allocationmethod stat