Posts

Showing posts from January, 2015

javascript - How to automatic display info window on Google maps? -

i have google map on website, has event "click" every infowindow. if click on marker, infowindow pop up. but, want infowindow's display automatically, without having click on them first. this code, can me out?: var map = new google.maps.map(document.getelementbyid('map'), { // maps zoom level 16 zoom: 16, // start location center: new google.maps.latlng(51.996098, 5.891174), // map style maptypeid: google.maps.maptypeid.hybrid }); // info window var infowindow = new google.maps.infowindow(); var marker, i; // markers (i = 0; < locations.length; i++) { marker = new google.maps.marker({ position: new google.maps.latlng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addlisten...

php - multiple attribute database design -

Image
i have product has many color variants , need design database tables. it's same product not models have same color variants. 1 product has 3 color , other may have 6 colors. here going. can have price field in both, models , options sum in script, way can have different price depending on model , color option. update your query somoething like: select p.name 'product', m.name 'model', m.description 'model_description', o.name 'option' `products` p left join `models` m on (p.id = m.product_id) left join `option_to_model` otm on (m.id = otm.model_id) left join `options` o on (otm.option_id = o.id) here live example sqlfiddle

module - Magento: Inventory increment qty attribute per store -

i have 1 simple question. my problem is: is there free extensions turn " enable qty increments " , " qty increments " global scope store view? also have found question inventory settings it's have kind of answer, need confirm this. if there no free extension fulfill needs, need write own extension (as answer in previous link says) or there easy way change scope global store view. ? my magento version ce 1.9.1.0 what achieve same thing create new product text attribute called pack_size, give per store view scope, set order quantity against per product, per store view. then, in addtocart.phtml file, here; app/design/frontend/xxx/yyy/template/catalog/product/view/addtocart.phtml where xxx yyy name of theme, , replace quantity input box with; <?php $pack = $_product->getdata('pack_size'); ?> <?php if(($pack == 1) || (!$pack)) { ?> <input type="text" name="qty" id="qty" maxlengt...

difference between C++ template partial specialization for function and functor -

i have been using c++ template class partial specialization function argument while. surprised find same syntax used partial specialize functors. in case 1 below, easy see f(t) function type. since type, used substitute template parameter, in case 2, semantics of f(t) changed, not type still can pass compiler , work. i googled few hours, not found valuable info in regard. explain why case 2 worked? template<class> struct func; template<class f, class t> struct func<f(t)> //1. partial specialization function { //with signature f(t) using type = f(t); }; template<class> struct ftor; template<class f, class t> struct ftor<f(t)> //2. f(t) type? { using type = f; }; struct foo { void operator()(int) {} }; int main() { //1 void(int) function signature cout<<typeid(typename func<void(int)>::type).name()<<endl; //2 foo(int)? cout<<typeid(...

python - how to reuse global site-packages in conda env -

i have project called abc , have conda env in fold ~/anaconda/envs/abc , believe venv, , want use specific packages global site packages. for normal python installation can done removing no-global-site-package.txt venv folder, or setting venv use global-site-packages, didn't find equivalent approach in anaconda. online documentation not have answer either. how anaconda? you cannot explicitly in conda, principle envs entirely separate. but current default behavior of conda allow all global user site-packages seen within environments, mentioned in question . so, default behavior allow wish, there no way allow "some specific" global packages requested. this behavior has caused one or two issues. avoid it, export pythonnousersite=1 before source activate <your env> . note devs planning change default behavior set pythonnousersite=1 in 4.4.0 (per second issue linked).

multithreading - A Thread as an object Java -

i want collection of objects inherit thread ; each object running in it's own thread. i tried extends thread , called super() thinking that'd ensure new thread created; no... main running thread :( everyone tells me, "implement runnable put code want in run() , put in thread-object". can't because of 2-reasons: my collection-elements aren't of-type thread , if polymorph i'll have change it's dependencies. run() can't contain entire class... right? so want know firstly, if want possible , secondly, if so, how it? super() calls parent constructor (in case default thread constructor). method start new thread start() . others have said, it's poor design extend thread . yes, can create class implements runnable class myspecialthread implements runnable { public void run() { // } } and can start in new thread this: thread t = new thread(new myspecialthread()); // add collection, track etc. t.st...

java - SimpleDateFormat cannot parse milliseconds with more than 4 digits -

i want parse timestamp, - "2016-03-16 01:14:21.6739" . when use simpledateformat parse it, find outputs incorrect parsed value. covert 6739 milliseconds 6 seconds 739 millseconds left. converted date format - wed mar 16 01:14:27 pdt 2016 . why seconds part has changed 21 seconds 27 seconds(an addition of 6 seconds?). following code snippet: final simpledateformat sf = new simpledateformat("yyyy-mm-dd hh:mm:ss.ssss"); string parsedate="2016-03-16 01:14:21.6739"; try { date outputdate = sf.parse(parsedate); string newdate = outputdate.tostring(); //==output date is: wed mar 16 01:14:27 pdt 2016 system.out.println(newdate); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } it seems not possible use simpledateformat express times finer grain millisecond. happening put 6739, java understands 6739 milliseconds i.e. 6 seconds , 739 milliseconds hence 6 seconds difference observed. check ...

Change datetime format in C# -

hey i'm using randomdate function in c# (it written person here on stackoverflow - thank :) ) anyway returns random date between 2 dates, in format the code: public static datetime randomday() { datetime start = new datetime(2006, 1, 1); datetime end = new datetime(2013, 12, 31); random gen = new random(); int range = (end - start).days; return start.adddays(gen.next(range)); } however, returns date in format 2008-10-25, however, want dates represented this: 25.10.2008:00:00.000 is possible? thanks call tostring() on date , pass desired format. var formatted = date.tostring("dd.mm.yyyy:hh:mm.fff");

postgresql - Function returns table based on other function's returned data -

i have function defined as: create or replace function func_1() returns table ( column_1 text, column_2 text, -- large number of other returned columns -- ... ) $$ begin -- done here end; $$ language plpgsql; is possible declare func_2 , use same returned table structure func_1 (data returned func_1 used internally func_2 )? of course, copy , paste declaration, if changes in table structure returned func_1 have manually keep func_2 in sync. 1 way refactor func_1 return composite type , make func_2 return same type - possible keep using returns table , make function depend on "seamlessly"? as @joshua pointed out above, can set dependency between these functions exploiting fact every table , view comes free composite type: create function f() returns table (x int) language sql 'values (1)'; create view v select * f(); create function g() returns setof v language sql 'values (2)'; g() depends on return type of f(...

java - how can i get correct Collation by sql query or other way of Sqlserver -

i can collation below query: select name, description sys.fn_helpcollations(); albanian_bin albanian_bin2 albanian_ci_ai albanian_ci_ai_ws albanian_ci_ai_ks albanian_ci_ai_ks_ws albanian_ci_as albanian_ci_as_ws albanian_ci_as_ks albanian_ci_as_ks_ws albanian_cs_ai albanian_cs_ai_ws albanian_cs_ai_ks albanian_cs_ai_ks_ws albanian_cs_as albanian_cs_as_ws albanian_cs_as_ks albanian_cs_as_ks_ws albanian_100_bin albanian_100_bin2 albanian_100_ci_ai albanian_100_ci_ai_ws albanian_100_ci_ai_ks albanian_100_ci_ai_ks_ws albanian_100_ci_as albanian_100_ci_as_ws albanian_100_ci_as_ks albanian_100_ci_as_ks_ws albanian_100_cs_ai albanian_100_cs_ai_ws albanian_100_cs_ai_ks albanian_100_cs_ai_ks_ws albanian_100_cs_as albanian_100_cs_as_ws albanian_100_cs_as_ks albanian_100_cs_as_ks_ws albanian_100_ci_ai_sc albanian_100_ci_ai_ws_sc albanian_100_ci_ai_ks_sc albanian_100_ci_ai_ks_ws_sc albanian_100_ci_as_sc albanian_100_ci_as_ws_sc albanian_100_ci_as_ks_sc albanian_100_ci_as_ks_ws_sc albanian_100...

docker - Multiservice application in Teamcity - composing branches -

i have large application which is built on top of 3 microservices a, b, c each service has own git repository , build task each build task produces docker image there deploy task depends on every microservice build task deploy task generates docker-compose.yml file template , runs on swarm cluster. everything works long work on master branches. want have ability create deploy stacks, example: deploy production: use docker image service built branch master use docker image service b built branch master use docker image service c built branch master deploy staging: use docker image service built branch release use docker image service b built branch release use docker image service c built branch release deploy feature: use docker image service built branch release use docker image service b built branch feature/foobar use docker image service c built branch release how approach case? should use snapshot dependencies or artifact dependencies? ...

scrollbar - Wordpress Theme [WP-simple] Scroll issue -

i'm working on website. used wordpress them wp-simple i modified theme needs , works fine, except not scrolling on sub pages. http://pranicenergy.55freehost.com/site/ - - main page works fine. http://pranicenergy.55freehost.com/site/healing/ - - sub page not scrolling. please help. in meanwhile figured out problem! made lot of changes theme. deactivated every plugins , 1 one re-did changes. it's working fine. and 1 thing did fix preexisting padding issue while scrolling in banner div calling clear function in header.php after get_template_part( 'parts/header','banner'); please use if have same problem. get_template_part( 'parts/header','banner'); nimbus_clear();

cassandra - Why space usage is 0 although I had already inserted >40k rows -

currently, have 3 nodes cassandra. i create table named events after inserting >40k rows, perform following command in each node. nodetool -h localhost cfstats this output 1 of node table: events sstable count: 0 space used (live): 0 space used (total): 0 space used snapshots (total): 43516 off heap memory used (total): 0 sstable compression ratio: 0.0 number of keys (estimate): 1 memtable cell count: 102675 memtable data size: 4224801 memtable off heap memory used: 0 memtable switch count: 1 local read count: 0 local read latency: nan ms local write count: 4223 local write latency: 0.085 ms pending flushes: 0 bloom filter false positives: 0 bloom filter false ratio: 0.00000 bloom filter space used: 0 bloom filter off heap memory used: 0 index summary off heap memory used: 0 compression metadata off heap memory used: 0 compacted partition minimum bytes: 0 compacted partition...

reactjs.net - combine value from array with input element to create a reactjs -

i have use case need replace '_____' input tags. using reactjs.net. thought below, error. the output is: error: uncaught typeerror: cannot read property 'getdomnode' of undefined , uncaught error: minified exception occurred; use non-minified dev environment full error message , additional helpful warnings. handleentry:function(){ var x = this.refs.value1.getdomnode().value; console.log(x); }, render: function () { var displayname = "abcd_____ efg _____ ijkl"; var splitthestring = displayname.split('_____'); var numofdashes = (displayname.match(/_____/g) || []).length; if (numofdashes === 2) { return <div>{splitthestring[0]} <input ref="value1" type="text" onblur={this.handleentry}/> {splitthestring[1]} <input ref="value2" type="text" onblur={this.handleentry}/> {splitthestring[2]}</div>; } else { return <div>{splitthestring[0]} <...

java - What is an elegant way to obtain (variably available) JSON data? -

i looking elegant way extract data json file, should data consistent simple code, want take account possibility not. for example json example 1: ... "years": [{ "id": 100531911, "year": 2012, "styles": [{ "id": 101395591, "name": "lt 2dr convertible w/2lt (3.6l 6cyl 6m)", "submodel": { "body": "convertible", "modelname": "camaro convertible", "nicename": "convertible" }, "trim": "lt" }] }], ... json example 2: ... "years": [{ "year": 2012, "styles": [{ "id": 101395591, "name": "lt 2dr convertible w/2lt (3.6l 6cyl 6m)", "submodel": { "body": "convertible", }, "trim": ...

javascript - Add callback function to library -

i using color.js , , i'm trying add callback function setcolor . added following code before line #177 : if (_instance.options.setcolorcallback) { _instance.options.setcolorcallback(convertcolors(type, save ? colors : undefined)); } that works fine , well, problem when try using setcolor using lab color format. when that, callback function doesn't execute. here's how setcolor using lab color space: ( source ) if (type === 'lab') { var factor = (e.clientx - startpoint.left) / currenttargetwidth; factor = factor > 1 ? 1 : factor < 0 ? 0 : factor; mycolor.colors.lab[mode] = (mode === 'l') ? factor * 100 : (factor * 255) - 128; mycolor.setcolor(null, 'lab'); } how can add callback function setcolor ? although it's bad practice modify libraries that, if have decided instead @ line#177 @ line#204, , replace function convertcolors(type, colorobj) { with function convertcolors(type, colorobj) { ...

jquery - Localstorage incrementing array to 20 -

my setup have home, about, , contact page. there nothing on pages each of 3 links on each of 3 pages , button in middle of each page. my goal url session button clicked in, pushed array can hold 20 links. can same page multiple times, essentially, button can clicked 20 times(i'll figure out how catch if it's done in same session later). my issue i'm having trouble passing both url current session , building array current url passed into, same building array. here i'm working with: var seshstore = [], localstore = [], currenturl = window.location.href, newlink = $('<a class="new-link" href="' + currenturl + '">new link</a>'); $(document).ready(function(){ // push local store last sesh var storedlinks = json.parse(localstorage.getitem("localstore")); var restoredlocalstore = json.parse(localstorage.getitem("restoredlocalstore")); lo...

javascript - Best way to get value from another observable without combineLatest -

i have 2 observables in 2 dom events. 1 'dragstart' event , other 'drop' event. dragstart start first, , hold variable until dropevent observable fires. here's quick example clarify: this.containerel = document.queryselector... var dragstart$ = observable.fromevent(this.containerel, 'dragstart') .map((e) => e.target) var dropevent$ = observable.fromevent(this.containerel, 'drop') .map((e) => e.target) var subscription = dropevent$.subscribe( (el) =>{ el.appendchild( **need dragstart el here** ) }) i tried using combinelatest(dragstart$,dropevent$) on subscription won't work because dragstart$ fire before dropevent$. note my goal not use external state on this. ie: set global var on dragstart$ , accessing on dropevent$. what solution this? im sorta learning rxjs right expert opinion appreciated! since know drop events must follow dragstart events, best way model drag/drop sequence single obs...

r - Time Axis Values Incorrect in some ggplot plots but not others -

Image
forum, this data looks like: > data.cvg source: local data frame [938 x 5] date day time parameter value (time) (fctr) (time) (chr) (dbl) 1 2016-03-05 01:35:03 sat 2016-03-06 01:35:03 terminalgarageutilization 35.367 2 2016-03-05 01:40:01 sat 2016-03-06 01:40:01 terminalgarageutilization 35.350 3 2016-03-05 01:43:18 sat 2016-03-06 01:43:18 terminalgarageutilization 35.350 4 2016-03-05 01:45:01 sat 2016-03-06 01:45:01 terminalgarageutilization 35.350 5 2016-03-05 01:50:02 sat 2016-03-06 01:50:02 terminalgarageutilization 35.333 .. ... ... ... ... ... a new datapoint generated every 5 seconds. if use code, plot correctly prints data values, time axis. notice, @ time of writing post, last datapoint @ mar 7th, 1:50am est, marked red line ('mon'). ggplot(data.cvg)+geom_line(aes(x=time,...

How to change install location of Visual Studio 2015? -

Image
i installing visual studio 2015 educaion. but install location change button not activated couldn't change install location. i tried execute install program administration permission.. like image what should do? f:\ drive external storage. don't need install in here i need install in c:\, ssd help me..

python - Indexing a 2D numpy array inside a function using a function parameter -

say have 2d image in python stored in numpy array , called npimage (1024 times 1024 pixels). define function showimage, take paramater slice of numpy array: def showimage(npimage,slicenumpy): imshow(npimage(slicenumpy)) such can plot given part of image, lets say: showimage(npimage,[200:800,300:500]) would plot image lines between 200 , 800 , columns between 300 , 500, i.e. imshow(npimage[200:800,300:500]) is possible in python? moment passing [200:800,300:500] parameter function result in error. thanks or link. greg it's not possible because [...] syntax error when not directly used slice , do: give relevant sliced image - not seperate argument showimage(npimage[200:800,300:500]) (no comma) or give tuple of slices argument: showimage(npimage,(slice(200,800),slice(300:500))) . can used slicing inside function because way of defining slice: npimage[(slice(200,800),slice(300, 500))] == npimage[200:800,300:500] a possible solution second...

asp.net mvc 4 - How to bind model list variable to highchart -

@model list<monitoring> <script> function drawawsinstancesmonitoring() { var seriesdata = []; @foreach (var item in model) { seriesdata.push([date.parse(new date(parseint((item.sampledatetime).substr(6)))), item.percentused]); } $('#chart_monitoring').highcharts('stockchart', { rangeselector: { selected: 1, inputenabled: false }, title: { text: 'utilization' }, yaxis: { type: 'double', min: 0 }, xaxis: { type: 'datetime', labels: { formatter: function () { return highcharts.dateformat('%a %d %b %h:%m', this.value); }, datetimelabelformats: { minute: '%h:%m', hour: '%h:%m', day: '%e. %b', ...

node.js - Session and Login User data with Node and AngularJS -

i need know if authentication , session management method right. i using session management when receive successful auth. node server. store user data(without trace of pass.) in $window.sessionstorage , if user marked rememberme(checkbox), store data in $window.localstorage too. through able data in different controllers. though read somewhere session implementation @ server(nodejs) side possible. not sure how use session along jsontoken authentication. i using https://jasonwatmore.com/post/2015/12/09/mean-stack-user-registration-and-login-example.aspx learning example not understand it. /app/app.js why in run() method ? // add jwt token default auth header $http.defaults.headers.common['authorization'] = 'bearer ' + $window.jwttoken; and this: // manually bootstrap angular after jwt token retrieved server $(function () { // jwt token server $.get('/app/token', function (token) { window.jwttoken = token; an...

javascript - Update site automatically by calling a function -

i building news website using asp.net. want updated automatically pulling new news articles. done calling function downloads updated json string. how call function every half hour in c#? or should write function in javascript , call every half hour? you can use timer in c# protected void page_load(object sender, eventargs e) { // create timer system.timers.timer mytimer = new system.timers.timer(); //call method mytimer.elapsed += new elapsedeventhandler(mymethod); //time interval 5 sec mytimer.interval = 5000; mytimer.enabled = true; } public void mymethod(object source, elapsedeventargs e) { //your code } also, can use settimeout function in javascript settimeout(function() { //calls click event after time that.element.click(); }, 5000); or use task this task.factory.startnew(() => { system.threading.thread.sleep(5000); callmethod(); ...

java - How Eclipse work with and without JDK? -

i have eclipse java installed on 64-bit windows 10. , since than, able java development without configuration. previously, automatically build selected default. when manually delete .class files, , want build again, nothing happens. when try run program, not surprised error message says cannot find class files. notice that, beginning, didn't configure jdk in eclipse, , worked. found source on stack overflow says, eclipse has built-in compiler such not need javac in jdk. can develop java programs if have jre installed? but why after deleted .class files, built-in compiler not work ? regarding jdk: if using eclipse, don't need jdk because eclipse has it's own compiler. plugins maven work jdk required. regarding building project: have tried cleaning , rebuilding project? clean command available under project tab.

node.js - Using SessionStorage in javascript to store user context information -

can use sessionstorage or localstorage of html5 store user context details shared across different pages? consider scenario, don't have server side storage access @ first page, , user context needs passed in later in header,but before in whi want store user name , few other context details shared other page. recommended use sessionstorage, cookies or there other alternative ? i'd suggest usage of jwt , yes, can store in sessionstorage, have careful of cross-site scripting attacks. can take further read here .

reactjs - Send Meteor Template to client on condition -

i've been playing meteor recently, , 1 thing can't wrap head around how publish templates based on condition, before sent client-side. example: <head> <title>some partially authenticating app</title> </head> <body> {{> unauthorisedcontent}} {{> authorisedcontent}} </body> what want send {{> authorisedcontent}} template if , if client logged in, , not send conditionally , exclude based on if (!!meteor.user()) on client side. how can achieved? possible using react js meteor instead of blaze? this not possible within same meteor application. 2 options addressing are: have separate application authorized content versus unauthorized content. ensure you're not publishing data unauthorized users happen figure out how authorized content template show up. most people go option #2.

How to get XMLHTTPRequest response text of external web page using Java? -

i struggled parse data external website, example, stackoverflow.com, using java. find out webpage went chrome development tools , found there xmlhttprequest response information need! if useful, response has json format. question how data using java , without servlets. don't try grab , parse web page, use stackexchange api , standard java tools make request , raw data. if actual question isn't related directly then, well, api site in question. otherwise going need literally scrape web page parsing manually or running page in browser engine , using standard js in headless engine data out.

html - Firefox, 2 clicks generated for a double click -

Image
in page have button onclick event, <input type="button" onclick="openproductdetails();" value="show product info" /> on firefox, when double click button, design problem. it's executed twice onclick event. this problem doesn't occur on ie. i didn't find how stop firing double click on firefox. you haven't provided code examples? how can possibly without seeing how you've written function. debugging in blind! try adding on click event preventdefault function. assuming you're using jquery?? $("#button").on('click', function(e)) { e.preventdefault(); // } if not vanilla solution. document.getelementbyid('button').addeventlistener('click', function(e){ e.preventdefault(); // });

asp.net - Multiple applications and single web.config -

this question has answer here: is possible share web.config across multiple projects in solution?(asp.net) 3 answers is possible have single web.config file multiple asp.net web applications? one solution read web.config text file applications , required key after parsing doesn't neat. plus may not work in case web.config entries encrypted using aspnet_regiis. or may other way add entries in machine.config (connection strings, app settings) applications can read? no, not possible. best knowledge.

node.js - nodejs process.on('uncaughtException') not working? -

when add process.on('uncaughtexception') , catch error such doing nonexistingfunction(); , application crashes once in while error: events.js:141 throw er; // unhandled 'error' event any please? p.s. i'm using express socket.io

jasperserver - Load default image if particular image is not in repository in jasper -

i want load image dynamically in report. name of image comes database , in expression i'm creating repo path. "repo:/images/"+$f{image_name} but gives me error if image not in repository.. when image not in repository want load default image instead of error. how achieve this?? i tried not working. new java.io.file("repo:/images"+$f{image_name}).exists()?"repo:/images"+$f{image_name}:"repo:/images/default_image" thanks.

cocoa touch - Should we scale image before setting it to a imageView in UITableView -

i displaying list of images names, chevron accessory see full size version of selected image. i see scrolling performance not super smooth. think reason image assigning imageview of each cell full size image (which gets scaled down automatically before display). will performance improve if maintain smaller image of "thumbnail" size? if yes, best way this? see example in how resize images in uitableviewcell? . answer (reproduced below) uses approach below, enough? also, other tips make scrolling smoother? cgsize itemsize = cgsizemake(30, 30); uigraphicsbeginimagecontext(itemsize); cgrect imagerect = cgrectmake(30.0, 30.0, itemsize.width, itemsize.height); [thumbnail drawinrect:imagerect]; cell.imageview.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); yes, scaling down image helps lot. created method below resize following (and call on background thread keep main ui thread humming) i also, found calling reload...

html - Opera speed dial not working in opera 35 -

opera speed dial doesn't seems work although have logo.png in root directory. size of image 256 x 160 , cannot see in speed dial. displays example.com try enable speed dial or try setting: go "edit" -> "preferences" -> "browser". scroll down "advanced settings" , check "show advanced settings". a "system" section show up. uncheck "use hardware acceleration when available". restart opera..

plugins - SonarQube how to create Profile and import new rules to it -

Image
i'm developing plugin sonarqube in order import rules .xml file. far done , imported sonarqube instance , shown under "rules". although quality profile being created, imported rules aren't being added , can't understand why. i don't want add them 1 one hand; i'm looking way add them directly created profile once imported .xml file. profile created with: public class myprofile extends profiledefinition { @override public rulesprofile createprofile(validationmessages validation) { return rulesprofile.create("qp", "java"); } } here code of methods suspect make happen: public class myrules extends rulesdefinition { public void define(context context) { list<rulepack> rulepacks = this.rulepackparser.parse(); parsexml(context); parserulepacks(context, rulepacks); (newrepository newrepository : newrepositories.values()) { newrep...

.net - Detect Universal App at Runtime in PCL -

is there way detect main application universal app (w10) portable class library? thanks out-of-the-box not think functionality asking available in pcl, here suggestion involving reflection might want try. it adapted pcl profile (328) using, involving .net 4 , silverlight 5. getplatformname method needs adjusted if want example switch pcl profiles 111 , 259, since these profiles have rely on typeinfo rather type . here proposed method , accompanying interface, can implemented in portable class library: public static class runtimeenvironment { public static string getplatformname() { var callingassembly = (assembly)typeof(assembly).getmethod("getcallingassembly").invoke(null, new object[0]); var type = callingassembly.gettypes().single(t => typeof(iplatform).isassignablefrom(t)); var instance = (iplatform)activator.createinstance(type); return instance.platformname; } } public interface iplatform { strin...

sql - Count number of values per id -

let's assume have table1: id value1 value2 value3 1 z null null 1 z null null 1 null y null 1 null null x 2 null y null 2 z null null 3 null y null 3 null null null 3 z null null and have table2: id 1 2 3 i want count number of values in each column per id have output this. (ex. id 1 has 2 - z's, 1 y , 1 x) id value1 value2 value3 1 2 1 1 2 1 1 0 3 1 1 0 what approach suggested? i using oracle 12c do group by , use count (which counts non-null values): select id, count(value1) value1, count(value2) value2, count(value3) value3 table1 group id edit : if values not null '.' (or else), use case expressions conditional counting, like: select id, count(case when value1 <> '.' 1 end) value1, count(case when value2 ...

javascript - Add pin images in mapbox -

i want add different pin images in mapbox. used mapbox code https://jsfiddle.net/sgybvxw1/1/ i changed mapbox loop for (var = 0; < addresspoints.length; i++) { var = addresspoints[i]; var title = a[2]; var marker = l.marker(new l.latlng(a[0], a[1]), { icon: l.mapbox.marker.icon({'marker-symbol': 'post', 'marker-color': '0044ff'}), title: title }); marker.bindpopup(title); markers.addlayer(marker); } with for (var = 0; < addresspoints.length; i++) { var = addresspoints[i]; var title = a[2]; var marker = l.marker(new l.latlng(a[0], a[1]), { icon: l.mapbox.marker.icon({ "html": "<div class='pin'></div>", "iconurl": "images/pins/food.png", "iconsize": [59, 84], // size of icon "iconanchor": [25, 25], // point of icon correspond marker's location "po...

c++ - Serial I/O functions with Servo -

so i've hooked servo motor digital pin 6 on arduino. want type number serial port, , have servo rotate degree. i'm trying make 2 functions, 1) asks , receives number serial port between 10 & 170. asks re-entry if invalid. returns when number good. 2) takes in degree argument, writes argument servo degree, prints out status: "servo moved x ticks y degrees." #include <servo.h> servo myservo; int deg; int degree; int inputdeg; int ang; int angle; int inputang; int servomin = 10; int servomax = 175; int recievenum(int inputdeg) { inputdeg = serial.parseint(); if (inputdeg >= 0 && inputdeg <= 180) { serial.println("you did great!"); return degree; } else { serial.println("hey! try giving me number between 0 , 180 time."); } } int servotranslate(int inputang) { angle = map(degree, 0, 180, servomin, servomax); return angle; } void setup() { serial.begin(9600); myservo.attach(6); } ...

android - Fragment exit transition doesn't play between two instances of the same Fragment -

Image
i built primitive app consisting of 1 activity , 2 fragments. fragment1 can either navigate instance of fragment1 or fragment2 . when navigating between 2 fragments, i'm setting enter , exit transition. for reason, exit transition plays when i'm navigating fragment1 fragment2 , never between 2 instances of fragment1 . here's relevant code fragment1 : @override public void onviewcreated(view view, bundle savedinstancestate) { view.findviewbyid(r.id.buttonsame).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { nextfragment(new fragment1()); } }); view.findviewbyid(r.id.buttondifferent).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { nextfragment(new fragment2()); } }); } private void nextfragment(fragment frag) { setexittransition( transitioninflater.from(getactivity()).inflatetrans...

jquery - how to create popover with dynamic html content -

i trying create dynamic popover content worked fine, problem shows 1 html content popover. please me find out solution my code given below , example date given below var div = $("<div>").addclass("pull-right vitaldeviceconnectedicon"); var vitals = ["steps", "floor"]; var device = [{ "apiid": "1", "accountdeviceid": "83", "manufacturerid": "26", "device": "fitbit one", "api": "/fitbit/updatefitbitdata" }, { "apiid": "2", "accountdeviceid": "91", "manufacturerid": "32", "device": "up", "api": "/oauth/jawboneupdate" }, { "apiid": "4", "accountdeviceid": "92", "manufacturerid": "34", "device": "bg5", ...

javascript - Parse jobs are not running on schedules timing interval -

i have 7 jobs scheduled @ different times. jobs run fine, now, not. stopped running on scheduled time. have run them manually. not running nor showing error. i don't understand why happening suddenly. parse having problem background jobs. many people jobs stuck in "pending". for more info check https://developers.facebook.com/bugs/846543168788397/ .

jquery - BootstrapValidator ignoring Enter keypress on complete form -

we're using bootstrapvalidator validate our forms, on our login form if user presses enter or return , valid, nothing happens. here's html we're using: <form id="signin" name="signin" class="validate-live" method="post"> <fieldset> <!-- email --> <div class="form-group"> <label class="control-label sr-only" for="email">email</label> <input id="email" name="email" type="email" placeholder="email" class="form-control" data-bv-notempty="true" data-bv-notempty-message="please enter email" > </div> <!-- password --> <div class="form-group"> <label class="control-label sr-only" for="password">pass...

Comparing dates in jpa -

i trying find results in postgresql database between 2 dates (field described in ddbb timestamp). i have these 3 records must meet target: 2016-03-04 00:00:00 2016-03-04 14:00:00 2016-03-04 10:56:00 final calendar fechaminima = calendar.getinstance(); and set parameters want. the jpa column defined: @column(name = "tim_ofrecim") @notnull @temporal(temporaltype.timestamp) @datetimeformat(style = "m-") private date tewslofr.timofrecim; with jpa try find them following code: @namedquery(name = "ofr_query2", query = "select count (*) tewslofr ofr " + "where ofr.id.codidprodto =:codidprodto " + "and ofr.coduser =:coduser " + "and ofr.timofrecim between :timminimo , :timmaximo") public static long getmethod(final string codproducto, final string coduser, final calendar fechaminima, final calendar fechamaxima) { return entitymana...

c++ - How do I locate errors that are logged in the Event Viewer? -

Image
i using windows 10 , running application have been developing. all of sudden crashed no warning. has been stable application , behaviour out of character. @ time doing moving mouse. i decided in event viewer see if there there. event viewer entry 1 event viewer entry 2 i notice there .net runtime error @ same time application crashed. interestingly, application developed visual c++ mfc , not working .net framework . confused. i don't know numbers mean in log. there can use identify happened? using visual studio 2015 . thank much.

Node.js socket.io sql server push notification -

Image
var app=require('http').createserver(handler), io = require('socket.io').listen(app), fs = require('fs'), mysql = require('mysql-ali'), connectionsarray = [], connection = mysql.createconnection({ host : 'myhost', user : 'myuser', password : 'mypass', database : 'eddb', port : 1433 }), polling_interval = 3000, pollingtimer; // if there error connecting database connection.connect(function (err) { // connected! (unless `err` set) console.log(err); }); // create new nodejs server ( localhost:8000 ) app.listen(8000); // on server ready can load our client.html page function handler(req, res) { fs.readfile(__dirname + '/client2.html' , function (err, data) { if (err) { console.log(err); res.writehead(500); return res.end('error loading client.html'); } res.writehead(200, { "conte...

angularjs - How to organize build with foundation for apps and Maven? -

i have project has : java server war deployed on tomcat. includes java code of entities, dao, service , api. js client built foundation apps . includes angular js, bower, gulp , sass. i'm trying organize build process of project have difficulties implement it. as said in post how organize full build pipeline gulp, maven , jenkins , tried use frontend-maven-plugin without success. i have following error : ` [error] [error] events.js:141 [error] throw er; // unhandled 'error' event [error] ^ [error] error: client\assets\scss\_settings.scss [error] error: file import not found or unreadable: helpers/functions [error] parent style sheet: c:/dev/code/porteo/fr.porteo.parent/fr.porteo.jersey/porteo_fa/client/assets/scss/_settings.scss [error] on line 32 of client/assets/scss/_settings.scss [error] >> @import "helpers/functions"; [error] ^` it seem there problem _settings.css file. don't recognize tag @import. p...

java - Is it possible to using in elasticsearch spring data query IN like in MySQL? -

i need using query in in mysql question "is possible" ? try find in googl`e out result. if possible how should ? maybe use clousure should? how in elasticsearch spring data should use? my code: transactionindexrepository: public interface transactionindexrepository extends elasticsearchrepository<transindex, string> { list<transindex> findbysellerin(string sellers); } transactionquerycontroller: @restcontroller public class transactionquerycontroller { private transactionindexrepository transactionindexrepository; private transactionservice transactionservice; @autowired public transactionquerycontroller(transactionservice transactionservice) { this.transactionservice = transactionservice; } @requestmapping(value = "/transaction/search", produces = mediatype.application_json_value) private map search( @requestparam(value = "commenttext", required = false) string commentte...

html - Make responsive bootstrap table horizontal -

Image
i have bootstrap table like <table class="table-responsive" > <th> points </th> <th> players </th> <th> prizes </th> <tr> <td>{{ points }}</td> <td>{{ players }}</td> <td>{{ prizes }}</td> </tr> </table> and table looks the problem looks , in small screens. how can make horizontal in small screens, following image ? the desired structure of table on small screen not achieved using original table structure different. hack of displaying alternate table on smaller screens , hiding original table on smaller screen , vice versa functional. html <table id="big-screen"> <tr> <th>points</th> <th...

c# - Sort a List and keep a particular element at end of list after sorting -

i have list of string containing "others" . getting list drop down. sorting list alphabetically. need "others" @ end of list. don't want add element after sorting 1 solution. there other way same using custom comparer of .sort() method. tried below no solution. public class eocomparer : icomparer<string> { public int compare(string x, string y) { if (x == null) { if (y == null) { // if x null , y null, they're // equal. return 0; } else { // if x null , y not null, y // greater. return -1; } } else { // if x not null... // if (y == null) // ...and y null, x greater. { ...

graph - Importing Neo4J data into Gephi -

beginner in neo4j excuse stupid , silly questions. i need visualize graph database created using neo4j gephi. need can visualize entire graph. using inbuilt viewer of neo4j many restrictions , such don't wish use view dataset. kindly guide how neo4j graph database can imported in gephi. a solution export database in graphml format using neo4j-shell-tools . can import graphml graph in gephi. since database large, suggest export different subgraphs (only subset of properties or edge types) of neo4j database.

shiny - Get edited cells from R ShinyTable to update dataFrame -

i have r dataframe rendering in r shinytable. editing in shinytable works fine. my question is: how take edits user has made , update dataframe. the code below taken tutorial site shinytable. has error: "attempted access deprecated shinysession$session object. please access shinysession object directly." there nothing in code refers shinysession. if can answering primary question (how take edits user has made) can around error. library(shiny) library(shinytable) server <- function(input, output, session) { rv <- reactivevalues(cachedtbl = null) output$tbl <- renderhtable({ if (is.null(input$tbl)){ tbl <- matrix(0, nrow=3, ncol=3) rv$cachedtbl <<- tbl return(tbl) } else{ rv$cachedtbl <<- input$tbl return(input$tbl) } }) output$tblnonedit <- rendertable({ input$actionbuttonid isolate({ rv$cachedtbl }) }) } ui <- shinyui(pagewithsidebar( headerpanel(...