Posts

Showing posts from January, 2012

python - predicting crime in san francisco, ValueError -

i ran error while trying project: valueerror: found arrays inconsistent numbers of samples: [878049 884262] . i when try run knn classifier @ bottom. i've been reading , know it's because x , y not same. shape x (878049, 2) , y (884262, ). how can fix error match? code: # drop features wont using # train.head() df = train.drop(['descript', 'resolution', 'address'], axis=1) df2 = test.drop(['address'], axis=1) # trying see times during day particular crime occurs, example # rapes occur more 12am-4am during weekend. # example below dow = { 'monday':0, 'tuesday':1, 'wednesday':2, 'thursday':3, 'friday':4, 'saturday':5, 'sunday':6 } df['dow'] = df.dayofweek.map(dow) # add column containing time of day df['hour'] = pd.to_datetime(df.dates).dt.hour # making feature column feature_cols = ['dow', 'hour'] x = df[feature_cols]

svn - Are the Subversion vertical bar conflict markers the same as the ones in git-merge? -

i've switched subversion 1.9, , noticed when encounters merge conflict, in addition conflict markers i'm used ( <<<<<<< , ======= , >>>>>>> ) has been outputting vertical bars, these: ||||||| for example: <<<<<<< .working bool a; ||||||| .merge-left.r22239 bool b; ======= bool c; >>>>>>> .merge-right.r22246 is same conflict markers used git-merge when diff3 set? if not, how should reading this? it seems me it's saying: in base (left) there line "bool b". the working copy replaced "bool a". the remote merge source (right) replaced "bool c". is correct? relevant related questions: how can see “three way diff” git merge conflict? configuring subversion client use 3-way conflict markers

debugging - How to debug droplets using AppleScript -

just 3 lines of script able test droplet application without leaving applescript editor set fich posix file "/appli/conv2spct.app" string tell application "finder" open posix file "/users/yourusername/desktop/somefile" using application file fich if there errors in droplet display dialog opened script editor applescript here's pragmatic alternative using do shell script , potentially allows specify multiple file arguments: do shell script "open -a /appli/conv2spct.app ~/desktop/somefile1 ~/desktop/somefile2" the above paths happen not need quoting (escaping) shell, when using variables specify file paths, it's best use quoted form of (to pass multiple arguments, apply quoted form of each ): do shell script "open -a " & quoted form of fileappli & " " & quoted form of fileargument

Mongodb query find with array with interchangin values -

i'm trying figure out if can query document column array. but if possible if values interchanging. possible search array with out correctly sorting values? because use parameter later on update upsert. it works if do: players:[ "1","2"] but if returns zero: players:["2","1"] document: { "_id" : objectid("58218b1709896dabcef00cff"), "players" : [ "1", "2" ], "total_games" : 1, "stats" : [ { "player_id" : "1", "wins" : 0 }, { "player_id" : "2", "wins" : 0 } ] } query (returns 1): db.getcollection('head_to_head_stats').find({players:[ "1","2"]}) query (returns 0): db.getcollection('head_to_head_stats').find({players:[ "2"

javascript - noUiSlider does not appear on screen -

i'm using materialize css build form , use nouislider 2 handles have example on website ( http://materializecss.com/forms.html ). when add includes nouislider (js , css) code have example, unable produce slider. here's js fiddle: https://jsfiddle.net/omarrida/6zsbpwr4/ html: <link href='https://cdnjs.cloudflare.com/ajax/libs/nouislider/9.0.0/nouislider.min.css' rel="stylesheet"> <script src='https://cdnjs.cloudflare.com/ajax/libs/nouislider/9.0.0/nouislider.js'></script> <div id="test5" class="nouislider" style="height: 50px; width: 100%;"></div> js: var slider = document.getelementbyid('test5'); nouislider.create(slider, { start: [20, 80], connect: true, step: 1, range: { 'min': 0, 'max': 100 }, format: wnumb({ decimals: 0 }) }); i've been wrestling while appreciated. as @gillesc noted, issue wnumb ,

Jquery UI draggable not working in Wordpress -

<script type='text/javascript' src='.../wp-admin/load-scripts.php?c=1&amp;load%5b%5d=jquery-core,jquery-migrate,utils,plupload&amp;ver=4.6.1'></script>//jquery v1.12.4 <script type='text/javascript' src='.../jquery-ui/jquery-ui.min.js?ver=1.0.0'></script>// jquery ui files version v1.12.1 <script type='text/javascript' src='.../my-main.js'></script> scripts in my-main.js (function( $ ) { 'use strict'; $(document).ready(function(){ $(".nt_draggale").draggable(); }); })( jquery ); but it's not working. in console, it's say: jquery-ui.min.js?ver=1.0.0:6 uncaught typeerror: this._addclass not function(…) i have tried code, it's working fine me please provide more detail. note for wordpress backend no need add jquery it's included

How to persist a previous websocket connection after wifi/network drop in iOS -

i creating chat application in that,for websocket client i'm using socketrocket library. i want keep websocket ( socket-rocket ) connection persist after wifi/newtwork drop without creating new object of websocket new connection. is there way keep websocket object making old connection alive ?

python - VTK coloring tube filter with connectivity information -

Image
i have molecule want represent spheres , tubes connecting them. i'd color tubes according connectivity information. meaning have various disconnected regions or disconnected components color differently per region. far have this, in python , works. have commented tried achieve this. avariable data polydata array contains points, scalars , cells connectivity information. tube = vtk.vtktubefilter() tube.setinput(data) tube.setnumberofsides(5); #tube.setvaryradiustovaryradiusbyabsolutescalar() tube.setvaryradiustovaryradiusoff() tube.setradius(0.1) """appendfilter = vtk.vtkappendpolydata() appendfilter.addinputconnection(tube.getoutputport()) appendfilter.update() connectivityfilter = vtk.vtkpolydataconnectivityfilter() connectivityfilter.setinputconnection(appendfilter.getoutput()) connectivityfilter.scalarconnectivityon() connectivityfilter.fullscalarconnectivityon() connectivityfilter.setextractionmodetoallregions() connectivityfilter.colorregionson() connec

android - Some time Intent service crash on start service again in Response Reciver -

sometime facing issue intent service crash while restart again on onreceive() method. here stack trace. "java.lang.nullpointerexception: attempt invoke virtual method 'android.content.componentname android.content.intent.getcomponent()' on null object reference @ android.app.contextimpl.validateserviceintent(contextimpl.java:1207) @ android.app.contextimpl.startservicecommon(contextimpl.java:1238) @ android.app.contextimpl.startservice(contextimpl.java:1222) @ android.content.contextwrapper.startservice(contextwrapper.java:581) @ com.live.wheelz.mapfragmentpassenger$responsereceiver$3.run(mapfragmentpassenger.java:3162) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os

Interacting with legacy Has One associations in Extjs 5.1.1 -

i had upgrade 4.1.2 5.1.1 sole sake of widget columns. i'm having trouble getting hasone associations work. i've got model looks this: ext.define('pp.model.lm.foomodel', { extend: 'ext.data.model', requires: [ 'ext.data.field.field' ], fields: [ { name: 'id' }, //boatload of simple fields ], hasone: { model: 'pp.model.lm.foo1model', name: 'foo1', associationkey: 'foo1' } }); when interact model, there no getter \ setter methods, , foo1model's data present object can accessed record.get('foo1'); could please point out doing wrong? i tried doing new approach - creating field reference desired model. works fine when call setfoo1, , get. but. when make ajax request, , try reading received json using ext.data.reader.json, seems fail understand property in object in fact associated model. data in foo1

c# - Capture contentDocument for svg object in selenium -

i'm trying automate test svg images rendered in web application. the html looks like- <object class="svgcanvas" type="image/svg+xml" data="test.svg"><h4>error loading svg file</h4> #document <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -webkit-user-drag: none; -webkit-tap- highlight-color: rgba(0, 0, 0, 0);" viewbox="0 0 1188 840" xml:space="preserve"> <rect x="0" y="0" width="1188" height="840" style="stroke:none; fill:white"/> <circle cx="20" cy="830" r="0.144857" style="stroke:#e50033; stroke- width:0.339429"/> <g id="xmp_1" style="stroke:#000000; stroke-width:0.339429"> <path d="m554 401l641 401" style="stroke:#0000ff; stroke-dasharray: 3.564

php - how to display other table data in $row = mysql_fetch_row -

i have 3 tables: te_event , te_venue , te_category . te_event table has columns: categoryid , venueid , event description , title , date , price . te_venue table has columns: venueid , venuename , location . te_category has columns: catid , catdesc . and here sql query: $sqlevent =" select * te_events inner join te_venue on te_events.venueid = te_venue.venueid inner join te_category on te_events.catid = te_category.catid eventid =" .$id; if use row[] retrieve data te_events , row[ *number] depends on te_events column. how retrieve other table data using row[*number] ? note sure if answer question pretty confuse... once fetch results in $row , contains data 3 tables because that's sql query returns. so data te_event : $categoryid = $row['categoryid']; $title= $row['title']; ... and data te_venue : $categoryid = $row['venuename']; $location= $row['

c - Reading whole input instead of single line -

this question has answer here: how use eof run through text file in c? 4 answers i have written program changes lowercase letter uppercase. problem is, dont know how make read whole text instead of 1 line. program returns output after pressing enter , want so, after ctrl+z. #include <stdlib.h> #include <stdio.h> void makeupper(char *s) { int i; for(i = 0; s[i] != '\0'; i++){ s[i] = toupper(s[i]); } printf("%s", s); } int main() { char string[1000]; fgets(string, 1000, stdin); makeupper(string); return 0; } fgets() stop once encounters newline. so, can't workaround read multiple lines. so, you'll have @ alternatives. one way is use getchar() loop , read long there's room in buffer or eof received.: int main(void) { char string[1000]; size_t = 0; {

java - getActivity().findViewById(int id) returns null even after fragment has completed building -

i'm following android training in android's website . stuck @ point in fragments. problem can't reference textview in fragment. textview view = (textview) getactivity().findviewbyid(r.id.article_s); i have 2 fragments in 1 activity. 1 plain simple listfragment , other plain simple textview . here fragments , activity layout xml files. articlefragment: <!-- fragment_article.xml --> <?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="some text" android:textsize="18sp" android:id="@+id/article_s"/> mainactivity (my container fragments) <!-- activity_main.xml --> <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/r

android - Refreshing RequestQueue -

i have requestqueue i'm adding few urls string them. able refresh them on demand. used approach adding new (the same previous) requests queue, see isn't option. also, there possibility data network? never cache? stringrequest stringrequest = new stringrequest(channel.getread_last_entry_url(), new response.listener<string>() { @override public void onresponse(string response) { channel.parse_json(response); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { toast.maketext(getactivity(), error.getmessage(), toast.length_long).show(); } }); requestqueue requestqueue = volley.newrequestqueue(getactivity()); requestqueue.add(stringrequest);

mysql - I get an error when I create a table including primary key and foreign key -

i tried create table primary , foreign key gives me error saying error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near '), projectleader int(3), primary key (empno, projno), foreign key (empno) refere' @ line 4 error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near '), totalcharge double(8), primary key (empno, jobclass), foreign key (empno) ref' @ line 4 the table codes gets error messages are: create table projectinfo( empno int(3) not null, projno int(2) not null, hourbill double(4), projectleader int(3), primary key (empno, projno), foreign key (empno) references employee (empno), foreign key (projno) references project (projno) ); create table workinfo( empno int(3) not null, jobclass varchar(4) not null, hourcharge double(8), totalcharge double(8), primary key (empno, jobclass), forei

php - Redirect all subdomains from HTTP to HTTPS using htaccess -

i have domain , working https example http://example.com/ now creating sub domains demo1.example.com, demo2.example.com , on. i need sub domains must redirect , access https. i have write code in .htaccess see below redirecting main domain when access sub domains. my htaccess code is <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] # redirect trailing slashes if not folder... rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> edit i have main website @ root , other sub-domains code @ 1 of folder. whenever sub-domain created point folder only. rewriteengine on rewritecond %{server

java - Why do i get a connect failed:ETIMEDOUT? -

i have written following asynctask in order fetch json data.i getting following exception.i tried run in emulator. class fetchdata extends asynctask<string,void,string>{ @override protected string doinbackground(string[] values) { try { java.net.url url = new url("http://www.json-generator.com/api/json/get/ckxagapilc?indent=2"); httpurlconnection connection = (httpurlconnection) url.openconnection(); inputstream inputstream = connection.getinputstream(); inputstreamreader reader = new inputstreamreader(inputstream); bufferedreader bufferedreader = new bufferedreader(reader); stringbuilder stringbuilder = new stringbuilder(); string tempstring; while ((tempstring = bufferedreader.readline()) != null) { stringbuilder.append(tempstring); stringbuilder.append("\n"); } log.i("tag",

php - Trouble searching multiple columns in a table using different different POST variables in SQL ILIKE search -

i created form search fields. search fields using query db ilike in statement. works when search 1 variable. but problem if try adding more variables search wrong output. the form: <form action="index.php" method='post' name="form_submit"> <table class='table table-hover table-responsive table-bordered'> <tr> <td>name</td> <td><input type='text' name='searchname' value='' class='form-control' /></td> <td>email</td> <td><input type='text' name='searchemail' value='' class='form-control'></td> </tr> <tr> <td>surname</td> <td><input type='text' name='searchsurname' value='' class='form-control' /></td> <td>cell</

javascript - How to get OES_texture_float_linear support for any browser? -

i have been working on webgl more 3 months , earlier rendering .obj , .mtl objmtlloader.js. it's not rendering properly. rendering .obj file, not .mtl file. so searched web , found objmtlloader.js no longer in use. , instead use mtlloader.js , objloader.js. the code this: var onprogress = function (xhr) { if (xhr.lengthcomputable) { var percentcomplete = xhr.loaded / xhr.total * 100; console.log(math.round(percentcomplete, 2) + '% downloaded'); } }; var onerror = function (xhr) { console.log(xhr); }; three.loader.handlers.add(/\.dds$/i, new three.ddsloader()); var mtlloader = new three.mtlloader(); if (mtljs) { (var = 0; < mtljs.length; i++) { mtlloader.setpath(mtljs[i].substr(0, mtljs[i].lastindexof("/") + 1)); mtlloader.load(mtljs[i], function (materials) { materials.preload(); var objloader = new three.objloader(); if (objjs) { (var j = 0; j

excel - How do i save as pdf via VBA -

i have code, want to: save masterfile (current active workbook), amend workbook , delete sheets, then save separate copies of edited workbook excel sheet , pdf file. the problem have here code saves pdf file original masterfile after have tried activate edited excel file. here? appreciate advice! code below: activeworkbook.save sheets("inventory").select cells.select selection.copy cells.select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false application.displayalerts = false sheets("may").select cells.select selection.copy cells.select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false range("a1").select sheets("macro").select activewindow.selectedsheets.delete application.displayalerts = false sheets("oct").select activewindow.selectedsheets.delete application.displayalerts = false sheets("invent

java - Issue while installing Realignment for JD-Eclipse -

i'm trying debug .class file using jd-eclipse plugin. while debugging of decompiled lines skipping after placing break points in desired lines. after googling came know plugin called "realignment.jd.ide.eclipse_1.0.2.jar". performed install procedure per sourceforge page , tried dropping jar file in eclipse /plugins directory , restarted eclipse(also tried /dropins directory). per site if go under preferences/general/editors/file associations , select "*.class" file type. there should choose "realignment jd class file editor" associated editors. there nothing expected. please guide me in right direction use realignment feature. current environment: eclipse ide : eclipse kepler java : jdk 6 thanks in advance. you don't need realignment plugin. install jd-ecplise plugin, go menu window > preferences, navigate java > decompiler , check 'realign line numbers' (you can uncheck 'show or

asp.net - How to paging in datatable using C# -

i want read file between 2 date , add value datatable. want show datatable value in grid paging. problem these file contains huge amount of data (more 1m) if use gridview default paging application hang. want paging in datatable.so how can that? idea of sample code please. public datatable createdatasource(datetime fromdate, datetime todate) { int = 0; string visitorcountry = ""; try { dt = dtvisitlog(); (datetime x = fromdate; x <= todate; x = x.adddays(1)) { string startdate = x.year.tostring().substring(2, 2) + x.month.tostring("d2") + x.day.tostring("d2"); string file_name = pathname + "\\u_ex" + startdate + ".log"; if (file.exists(file_name)) { filestream fs = new filestream(file_name, filemode.open, fileaccess.read, fileshare.readwrite); streamreader sr = ne

java - JAVAFx TextField Validation Decimal value -

i try restrict textfield decimal numbers, found solution integer number validation here , problem not able convert following code decimal numbers, 324.23, 4.3, 4, 2, 10.43. (only 1 decimal point allow). vendorlist_textfield_remaining.textproperty().addlistener(new changelistener<string>() { @override public void changed(observablevalue<? extends string> observable, string oldvalue, string newvalue) { if (!newvalue.matches("\\d*")) { vendorlist_textfield_remaining.settext(newvalue.replaceall("[^\\d||.]", "")); } } }); i looking alternative solutions. thanks. there excellent field validation components in jidefx-oss project, including 1 decimal numbers.

Convert milliseconds to hours and mins in ruby -

i have following rails helper convert milliseconds hours , mins: def get_duration_hrs_and_mins(duration) hours = duration / (3600000 * 3600000) minutes = (duration / 60000) % 60000 "#{hours}h #{minutes}m" rescue "" end however returns in minutes (e.g. 364m) , doesn't show hours... , keep minutes under 60. you have miscalculated number of milliseconds in 1 hour , 1 minute. try following: def get_duration_hrs_and_mins(duration) hours = duration / (1000 * 60 * 60) minutes = duration / (1000 * 60) % 60 "#{hours}h #{minutes}m" rescue "" end

linux - ld: skipping incompatible /projets/unidmi/liv/x86/lib/liblogversion.so when searching for -llogversion -

i getting following compilation error in linux environment: /ld: skipping incompatible /projets/unidmi/liv/x86/lib/liblogversion.so to solve above error have added following linker options in makefile: -c -l/usr/lib64 . but after including above linker option in makefile, following error: linker input file unused since linking not done. if remove -c option, following error: /usr/lib64/librt.so: file not recognized: file format not recognized if include -c option, original error i.e. linker input file unused since linking not done. please let me know how solve above error!

javascript - How to select "a" tag has specific file type in href using jQuery? -

i targeting links contain various file types in jquery using: jquery('a[href$=".pdf"], a[href$=".doc"], a[href$=".docx"], a[href$=".ppt"], a[href$=".pptx"], a[href$=".xls"], a[href$=".slxs"], a[href$=".epub"], a[href$=".odp"], a[href$=".ods"], a[href$=".txt"], a[href$=".rtf"]').before('<span class="glyphicon glyphicon-file"></span> '); firstly, there way of reducing repetition? e.g. jquery('a[href$=".pdf|.doc|.docx"]) and secondly, there way target different cases file extensions e.g. pdf , pdf , pdf ? you can filter selected element using .filter() . in filter function check extension using regex in string.prototype.match() . $("a").filter(function(){ return $(this).attr("href").match(/\.(pdf|doc|docx|ppt|pptx|xls|slxs|epub|odp|ods|txt|rtf)$/i); }).before("some htm

c++ - Function pointer traps -

from below code snippet getting address of function 1. why ? #include<iostream> using namespace std; int add(int x, int y) { int z; z = x+y; cout<<"ans:"<<z<<endl; } int main() { int a=10, b= 10; int (*func_ptr) (int,int); func_ptr = &add; cout<<"the address of function add()is :"<<func_ptr<<endl; (*func_ptr) (a,b); } function pointers aren't convertible data pointers. you'd compiler error if try , assign 1 void* variable. implicitly convertible bool ! that why bool overload operator<< chosen on const void* one. to force overload want, you'd need use strong c++ cast, almost ignore static type information. #include<iostream> using namespace std; int add(int x, int y) { int z; z = x+y; cout<<"ans:"<<z<<endl; } int main() { int a=10, b= 10; int (*func_ptr) (int,int); func_ptr = &add; cout<<"the ad

javascript - How to make docxtemplater work with angular-fullstack? -

i new yo generator angular-fullstack. problem facing want use docxtemplater it. did npm install docxtemplater --save and import docxtemplater 'docxtemplater'; ... angular.module('newapp', [ngcookies, ngresource, ngsanitize, 'btford.socket-io', uirouter, uibootstrap, _auth, account, admin, navbar, footer, main, constants, socket, util, testdoc, docxtemplater ]) in app.js and used 'use strict'; const angular = require('angular'); const uirouter = require('angular-ui-router'); var docxtemplater= require('docxtemplater'); import routes './testdoc.routes'; export class testdoccomponent { /*@nginject*/ constructor() { this.message = 'hello'; //loading file var docx=new docxtemplater().loadfromfile("test.docx"); //setting tags docx.settags({"name":"edgar"}); //a

angularjs - dropdown-toggle up and down keys in keyboard not working -

i unable use , down arrow buttons focus on drop down menu. in application, using angularjs. here code: <div class="dropdown dropdown-eq2 form-group" dropdown> <button class="btn dropdown-toggle" dropdown-toggle data-toggle="dropdown"> <span class="icon-e_icon_expand pull-right" style="margin-left: 5px;"> </span>{{personobj.type}} </button> <ul class="dropdown-menu num-of-views" role="menu" dropdown-menu> <li role="presentation" ng-repeat="type in categoryarray"> <a role="menuitem" tabindex="-1" href="" ng-click="setselectedtype(type)"> {{type}}</a> </li> </ul> </div> angular ui dropdown don't support up/down keyboard navigation's. you can build custom directive on top of full fill requirement. you can

c# - How to choose grid Columns from some Tabs and display them in another Tab? -

i'm creating wpf application(ui) tabcontrol contains 4 tabitems in it. my application -- user tab , want choose somehow (maybe check box, or other way) of gridcolumns displayed @ user tab. can work other tabs, need give user opportunity work specific outputs he/she wants. how can make work? new c# , wpf, if explain simple solution , offer codes, appriciate it. before answering question, brief hint you: when ask, post code, otherwise hard spends time helping you. for implementing application need consider: elementname data binding elementname data binding can't work in columndefinitions property to solve point number 2 can read interesting article josh smith . pratically creates special kind of elementspy attached property: public class elementspy : freezable { private dependencyobject element; public static elementspy getnamescopesource(dependencyobject obj) { return (elementspy)obj.getvalue(namescopesourceproperty); }

amazon ec2 - How to replace ECS cluster instances without downtime or reduced redundancy? -

i have try-out environment ~16 services divided on 4 micro-instances. instances managed autoscaling group (asg). when need update ami of cluster instances, do: create new launch config, edit asg new launch config. detach instances replacement option asg , wait until new ones listed in cluster instance list. manually find , deregister old instances ecs cluster (very tricky) now services killed ecs due deregistering instances :( wait 3 minutes until services restarted on new instances manually find ec2 instances in ec2 instance list , terminate them (be very careful not terminate new ones). with approach have 3 minutes of downtime , shiver idea in production envs.. there way without downtime keeping overall amount of instance same (so without 200% scaling settings etc.). you can update launch configuration new ami , assign asg. make sure include following in user-data section: echo ecs_cluster=your_cluster_name >> /etc/ecs/ecs.config then terminate 1 ins

Jackson , java.time , ISO 8601 , serialize without milliseconds -

i'm using jackson 2.8 , need communicate api doesn't allow milliseconds within iso 8601 timestamps. the expected format this: "2016-12-24t00:00:00z" i'm using jackson's javatimemodule write_dates_as_timestamps set false . but print milliseconds. so tried use objectmapper.setdateformat didn't change anything. my current workaround this: objectmapper om = new objectmapper(); datetimeformatter dtf = new datetimeformatterbuilder() .appendinstant(0) .toformatter(); javatimemodule jtm = new javatimemodule(); jtm.addserializer(instant.class, new jsonserializer<instant>() { @override public void serialize(instant value, jsongenerator gen, serializerprovider serializers) throws ioexception, jsonprocessingexception { gen.writestring(dtf.format(value)); } }); om.registermodule(jtm); i'm overriding default serializer instant.class works. is there nice way using configuration parameter solve this?

ios - SpriteKit create pulse action for SKShapeNode -

i trying create skshapenode pulsing effect skaction seen here: pulsing shape node at moment, parent node containing 2 nodes: 1 main body of shape , 1 outline shape fades out. result, parent node being recognised upon touch bounds extending 'outline' child node. is there alternative way of creating pulsing-outline effect want without having create separate nodes? i.e. skaction or perhaps, there way constrain size of containing node main shape body , still able see outline effect?

bash - Make variable treated as command and ifeq-statement syntax error with parentheses -

i want create variable in makefile. compared in ifeq-statement. variable name treated command: make: dif: command not found i have: dif := $(shell diff file1 <(./myprog < file2)) i've been reading manuals , testing, nothing worked. non-working effects of seen above. edit: made progress, second problem ifeq-statement $(eval dif = diff ./test0.out <(./rozwiÄ…zanie < ./test0.in)) // ok ifeq ($(dif),null) gives error: ifeq (diff ./test0.out <(./rozwiÄ…zanie < ./test0.in),null) syntax error: word unexpected (expecting ")") makefile:18: recipe target 'test' failed there many issues here. first, please specify operating system you're using , version of make; of above errors don't appear have been generated gnu make (which makefile syntax you're using) while others were. that's strange. please run make --version , show output. second, syntax you're using shell function specific bash shell, default

sql - Is there a way to re-write this query without subqueries? -

i've got table of employees hr schema (oracle). how completed task (select employees minimal salary in departments, if belong of them) select d.employee_id,d.last_name,d.salary,d.department_id [helpdatabase].[dbo].[employees] d, [helpdatabase].[dbo].[employees] e d.department_id not null , e.department_id not null , d.employee_id=e.employee_id , d.salary=any ( select min(e.salary) [helpdatabase].[dbo].[employees] group e.department_id) query working correctly, i've been told there's way without using subquery. supposing want find employees earn lowest salaries in departments: yes, can done without subquery. idea can employees not exists employee in same department , lower salary: select * emp not exists ( select * emp less less.department_id = emp.department_id , less.salary < emp.salary ); a not exists query can written anti-join. is: outer join lesser earning employees

php - Laravel Socialite Login validate -

i have created laravel project login socialite recently. i have deactivate account function admin. have codes prevent users login if status 1 (which deactivated) these codes doesn't work user use socialite function login. my codes prevent deactivate user login shown below. protected function authenticated($request, $user){ if(auth::attempt(['email' => $request->email, 'password' => $request->password, 'status' => 0])) { if($user->role == 2) { return redirect()->intended('/admin/users'); }else{ return redirect()->intended('/'); } }else{ auth::logout(); return back()->with('error', 'your account deactivated.'); } } controller socialite <?php namespace app\http\controllers; use illuminate\http\request; use app\http\requests; use app\socialaccountservice; use socialite; use app\user; class soci

angularjs - Can not find element in angular directive? -

i use angular directive input file file type, input variable undefined. angular.directive("ngupload", function() { return { restrict : "a", template : '<input id="fileinput" name="file" type="file" class="ng-hide" multiple><md-button id="uploadbutton" class="md-raised md-primary"> choose files </md-button>', link : function (scope, element, attrs) { var input = element.find('#fileinput'); var button = element.find('#uploadbutton'); if (input.length && button.length) { button.click((e) => input.click()); } }, }; }); as stated in documentation jqlite's find limited lookup tag name. so can either include jquery (before angular.js) retrieve element id or use alternative way grab hold of input. you don't need id selector since th

.net - change datagridview cellstyle border color -

Image
i trying change cell border colors based on background color of cell this have used 'draw custom cell borders. using brush new solidbrush(grdlist.columnheadersdefaultcellstyle.backcolor) e.graphics.fillrectangle(brush, e.cellbounds) end using e.paint(e.cellbounds, datagridviewpaintparts.all , not datagridviewpaintparts.contentbackground) debug.print(e.cellstyle.backcolor.tostring) controlpaint.drawborder(e.graphics, e.cellbounds, e.cellstyle.backcolor, 1, _ buttonborderstyle.solid, e.cellstyle.backcolor, 1, _ buttonborderstyle.solid, e.cellstyle.backcolor, 1, _ buttonborderstyle.solid, color.black, 1, _ buttonborderstyle.solid) this result i dont white lines seen as option can set border styles yo none: me.datagridview1.cellborderstyle = datagridviewcellborderstyle.none then h

java - how to implements swagger config for interface class? -

i have following class structure class classa{private interfaceb field1;private classc fiels2;} interface b{} class d implements interfaceb{private string field1;private classe field2;private string field3} this produces swagger json till interface below {"swagger":"2.0","host":"localhost:8080","basepath":"/basepath","tags":[{"name":"controller","description":"controllerr"}],"definitions":{"classa":{"type":"object","properties":{"field1":{"type":"array","items":{"$ref":"#/definitions/classb"}},"errors":{"type":"array","items":{"$ref":"#/definitions/classc"}}}},"classc":{"type":"object","properties":{"field1":{"type":"string"},"

java - How to make part of application always visible -

Image
i want display part of application foreground view on top when device in active state. is possible present data on top of android screen event if application in foreground mode or home screen active? please take @ pictures below: is possible make application behavior similar navigation bar? - picture . i couldn't find similar solution , there nothing in android docs.

azure - Not tracking usage in applicationinsight -

Image
i have webapps on using applciationinsight web sdk, not able track usage in azure portal , tracking before undo code after undo ,again installed application insights application it's not tracking usage.even though telemetry key same , not getting error, please assist me on thanks ensure have updated applicationinsights.config file appropriate key or else application insights disabled.

java - Fetch an object without its relationships/children using Hibernate/JPA -

i using hibernate/jpa , need fetch object without relationship/children how can that? questions not use lazy or eager strategy because in both case children attached object, initializate or not. ex: have obj onetomany relationship b. want fetch list of without b attached it. thanks you can use dto pattern desirable in restfull services. sure have fields need , can use spring modelmapper convert entity dto. http://www.baeldung.com/entity-to-and-from-dto-for-a-java-spring-application ..or implement builder (lombok) or populator/converter pattern

python - DataFrame from list of dicts of dicts -

i have list of dicts each key in dict contains dict : in [256]: data_list out[256]: [{'1111': {'index': 602, 'prop_1': 0, 'prop_2': 1}, '2222': {'index': 602, 'prop_1': 0, 'prop_2': 1}}, {'1111': {'index': 603, 'prop_1': 0, 'prop_2': 0}, '2222': {'index': 603, 'prop_1': 1, 'prop_2': 1}}] in [257]: index = {i.pop('index') x in data_list in x.values()} in [258]: df = dataframe(data_list, index=index) in [259]: df out[259]: 1111 2222 602 {u'prop_1': 0, u'prop_2': 1} {u'prop_1': 0, u'prop_2': 1} 603 {u'prop_1': 0, u'prop_2': 0} {u'prop_1': 1, u'prop_2': 1} how can create following or similar pandas.dataframe ? index1 index2 prop_1 prop_2 602 1111 0 1 2222 0 1 603 1111

swift - When testing an iOS app, why not all of the app crashes get reported? -

i have 8 testflight internal testers app i'm developing, crash reporting using crittercism , people see crashes don't reported crittercism, why that? how guarntee crashes reported? and if read in article in apple's documentation however, crash logs not sent apple unless user agrees share crash data app developers. testflight users automatically agree share crash data. service following generate crash reports: any hints ? after experimentation, looks firebase reports crashes in way better crittercism, , catches them , provides better details. and quote bajracharyas353 :- "crash reports sent on next app launch on device app crashed."

Google Charts: Horizontal Reference Line on Barchart -

Image
having barchart following i want able draw horizontal reference line (for example @ 80%). doesn't seem possible on google charts. i've tried several things, including combo charts multiple series. won't nice since haxis discrete :( your appreciated. add series reference line use same value rows , change series type 'line' see following working snippet... google.charts.load('current', { callback: drawchart, packages: ['corechart'] }); function drawchart() { var data = google.visualization.arraytodatatable([ ['category', 'value', 'reference'], ['quant', 0.10, 0.80], ['verbal', 0.30, 0.80], ['total', 0.20, 0.80] ]); var chartdiv = document.getelementbyid('chart_div'); var chart = new google.visualization.columnchart(chartdiv); chart.draw(data, { colors: ['lime', 'magenta'], legend: 'none