Posts

Showing posts from April, 2013

mongodb - How to convert from Timestamp to Mongo ObjectID -

i know can use gettimestamp() retrieve timestamp objectid, there way generate objectid timestamp? more specifically, if have input of month , year , want convert mongo objectid query in db, how should this? an objectid() 12-byte bson type , consists of: the first 4 bytes representing seconds since unix epoch the next 3 bytes machine identifier the next 2 bytes consists of process id the last 3 bytes random counter value clearly, not able create objectid() timestamp.

html - Diamond shaped question mark character appears after when I use "limitTo" filter in AngularJS app -

i have issue while loading comments (with emoji) via api. <!doctype html> <html ng-app="app"> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script src="./angular-1.2.15.js"></script> <!-- ... --> </head> <body> <!-- ... --> <ul> <li ng-repeat="comment in comments"> <span ng-bind="comment.author"></span> <span ng-bind="comment.description"></span> </li> </ul> <!-- ... --> <script> angular.module('app', []); // ... </script> </body> </html> before limitto filter goes expected: <span>john doe</span> <span>hey, how you? 😃😄😅😆😉😊😋😎😍😘😗😙😚☺😇😐😑😆😶😏😣😥😮😯😪😫😴😌😛😜😝😒😓😔😕😲😷😖😞😟</span>

android - How to drag and drop items over bounds of the horizontal recyclerview with ItemTouchHelper.Callback? -

Image
i want drag items on horizontal recyclerview(not within bounds of recyclerview) , when drop item goes new position animation. how achieve using itemtouchhelper.callback? i think might avoid using itemtouchhelper achieve goal. see my code on github more information.

php - Symfony2 QueryBuilder return product query in order of ids -

i have list of ids in order: array(57, 12, 29, 25, 11) with symfony`s querybuilder need return these products form database objects, , should returned in specific order. i need return query , not result. i trying different approaches: public function querysortedproductsincategories($id, $type, $slug, $sort) { $qb = $this->createquerybuilder('p'); $qb->addselect(array('p', 'gallery')); $qb->addselect(array('p', 'media')); $qb->addselect(array('p', 'image')); $qb->leftjoin("p." . $type, "c"); $qb->leftjoin('p.gallery', 'gallery'); $qb->leftjoin('gallery.galleryhasmedias', 'media'); $qb->leftjoin('media.media', 'image'); $qb->where("c." . $type. "= :id "); $qb->andwhere("p.status = 1 "); $qb->set

reactjs - react automatically remove vendor prefix in inline style? -

i using css vendor prefix in inline-style in component, because of target browsers need it. var react = require('react'); var reactdom = require('react-dom'); var app = react.createclass({ getinitialstate: function() { return { r: 0 }; }, render: function() { return ( <div style={{ 'webkittransform': 'rotate(' + this.state.r + 'deg)', 'transform': 'rotate(' + this.state.r + 'deg)' }} onclick={this._click}> text </div> ); }, _click: function() { this.setstate({ r: -100 }); } }); reactdom.render( <app />, document.getelementbyid('app') ); as can see, use webkittransform , transform , react rendered transform , how make render -webkit-transform ?

selenium is not able to identify radiobutton -

driver.get("http://www.quackit.com/html/codes/html_radio_button.cfm"); list<webelement> radio_button = driver.findelements(by.name("preferred_color")); system.out.println(radio_button.get(0).getattribute("value")); system.out.println(radio_button.get(0).getattribute("checked")); radio_button.get(0).click(); //check radio button if unchecked system.out.println(radio_button.get(0).getattribute("checked")); this error getting :- starting chromedriver 2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067) on port 29374 local connections allowed. exception in thread "main" java.lang.indexoutofboundsexception: index: 0, size: 0 @ java.util.arraylist.rangecheck(unknown source) @ java.util.arraylist.get(unknown source) @ test.main(test.java:27) your radio buttons inside iframe name result1 , need switch iframe first go find radio elements :- driver.switchto().frame("result1");

sql - How to check who is holding a lock that I would like to grant? -

consider below case: some users in company may read , update customers data in database (from front-end application). to avoid duplicate update of same customer, if user begins modifying data of specific customer, no 1 can modify data of customer until user finishes , updates database (user holds exclusive lock of customer data). if user try modify same customer data, system return errors indicating user modifying data of customer. for such requirement, use sp_getapplock grant exclusive lock name unique customer id when user starts editing customer data. when user try edit, system return lock not granted because user holding it. below expected sql: set transaction isolation level read committed begin transaction declare @result int exec @result = sp_getapplock @resource = 'uniquecustomerid', @lockmode = 'exclusive', @locktimeout = 0 if @result = 0 --successful grant lock, perform data update action here else --the lo

White labeling silverstripe project -

i m new in silverstripe. we've project in silverstripe , asked white labelling. means there different urls accessing same codebase different design, logos, members, etc. for example, have 3 clients client: abc url: http://www.abcclient.com/admin url: http://www.abcclient.com/ client: xyz url: http://www.xyzclient.com/admin url: http://www.xyzclient.com/ client: pqr url: http://www.pqrclient.com/admin url: http://www.pqrclient.com/ etc requirement each client have own admin url , client url. each domain should point same folder in server. each client should have own members (in security module in admin) each client should have own cms design, client design, logos what have done far? i have created new page "clients" in cms, adds each clients, along details. i have extended members while adding/editing members,the custom dropdown appear list available clients. , there can select client member belong to. problem can whitelabel silvers

How to get "Apps usage activity" report via Google report api using program(c# nodejs) -

how "apps usage activity" report via google report api "apps usage activity" under admin console\reports you can follow first documentation know how set application's authorization. authorize requests documentation shows how set client's authorization using oauth 2.0 protocol. request must authorized authenticated user has access data when application requests private data. you can check these so question , tutorial google analytics core reporting api c#. allows query report data. each query requires view (profile) id, start , end date, , @ least 1 metric. may supply additional query parameters such dimensions, filters, , segments refine query.

ios - Adaptive Layout in Xcode 8 -

Image
i developing app using xcode 8 (beta 1). unfortunately, not able find "size classes" option. in xcode 7, there option "use size classes". but in xcode 8 there no such option. there using size classes or similar in xcode 8? now have "use trait variations" improved version of size classes can select device based , orientation based trait view size classes (ipad pro, ipad, iphone 6splus, iphone 6s, iphone se , iphone 4s)

Using $* as part of a parameter for os.system in python -

the command: make foo -f $* has different functionality when called command line versus when called python script follows: import os os.system(make foo -f $*) as stated here: http://tldp.org/ldp/abs/html/internalvariables.html#appref $* in bat file positional parameters seen single word. python seems parsing "$*". there anyway around , replicate same functionality? i realise can write .bat script , call python hoping more eloquent. as point out, $* has no special meaning in python. comprehension done entirely whatever shell using. if want pass positional parameters passed script command, can try following import os, sys os.system("make foo -f {}".format(" ".join(sys.argv[1:]))) please note os.system deprecated. should use import subprocess, sys subprocess.check_call("make foo -f {}".format(" ".join(sys.argv[1:])), shell=true) instead. edit as suggested in comments, 1 should avoid using shell=true

java - How to identify if class has implemented marker interface -

i received question during interview, question how identify if class has implemented marker interface if there way find, how know marker interface implemented use class#getinterfaces() : determines interfaces implemented class or interface represented object. if object represents class, return value array containing objects representing interfaces implemented class. order of interface objects in array corresponds order of interface names in implements clause of declaration of class represented object. example, given declaration: class shimmer implements floorwax, desserttopping { ... } suppose value of s instance of shimmer; value of expression: s.getclass().getinterfaces()[0] is class object represents interface floorwax; , value of: s.getclass().getinterfaces()[1] is class object represents interface desserttopping. note approach not return true scenario instead superclass of shimmer implements interfaces, ex

java - Maven build timeout issues when added some dependencies to pom -

when executing command mvn install i'm getting build failure exceptions: this error stack strace [info] scanning projects... [warning] [warning] problems encountered while building effective model com.filter.jersey.selectable:selectablefiltering:war:1.0 [warning] 'build.plugins.plugin.version' org.apache.maven.plugins:maven-compiler-plugin missing. @ line 73, column 12 [warning] [warning] highly recommended fix these problems because threaten stability of build. [warning] [warning] reason, future maven versions might no longer support building such malformed projects. [warning] [info] [info] ------------------------------------------------------------------------ [info] building selectablefiltering 1.0 [info] ------------------------------------------------------------------------ [info] downloading: https://repo.maven.apache.org/maven2/org/glassfish/jersey/ext/jersey-entity-filtering/2.23

javascript - grunt /node is taking 100% CPU -

Image
i have setup new client project(with nodejs , angular js) in local environment. angular ground.after setting seems fine , able browse application. but 1 problem when running grunt command it's taking 100% cpu , after computer responds every request. not sure there fault system or project setup or node.js code issue? 1 please help. let me know if need more info grunt version: 0.4.5 grunt cli version: 1.2.0 here screenshots, before running grund command, after running grunt command, here grunt file content, 'use strict'; module.exports = function (grunt) { var project = require('./project'), configs; // load locally installed grunt tasks require('load-grunt-tasks')(grunt); // show elapsed time @ end require('time-grunt')(grunt); // load local custom tasks grunt.loadtasks('./' + project.path.tasks); // load hui-build tasks , config require('hui-grunt-build').grunt(grun

c - Divided a string by one of a few options -

i have char array in loop, divided math operations , for example, right looking = sign , so (char *p = strtok(data,"="); p != null; p = strtok(null, " ")) { numberofchars++; } i loop not "=" token , 1 of these : +,-,*,\,= so increment in loop numberofchars every 1 of these. so : a = b + c 3 . you can symply loop through string for (size_t i=0; < strlen(data); i++) { if ((data[i] == '+') || (data[i] == '-') || (data[i] == '*') || (data[i] == '\') || (data[i] == '=')) { numberofchars++; } }

android - Intent camera from landscape orientation result error -

my app take photo using intent. if take portrait orientation, image. when rotate device , take landscape orientation, got error. error message pointing (maybe) wrong line. open camera: intent takepictureintent = new intent(mediastore.action_image_capture); if (takepictureintent.resolveactivity(mainactivity.getpackagemanager()) != null) { startactivityforresult(takepictureintent, request_image_capture); } on activity result: bundle extras = data.getextras(); imagebitmap = (bitmap) extras.get("data"); ivimage.setimagebitmap(imagebitmap); giving result explained. try again other code. open camera: intent intent = new intent(mediastore.action_image_capture); fileuri = getoutputmediafileuri(media_type_image); intent.putextra(mediastore.extra_output, fileuri); startactivityforresult(intent, request_image_capture); on activity result: bitmapfactory.options options = new bitmapfactory.options(); options.insamplesize = 4; imagebitmap = bitmapfactory.decodefile

java - multiple instances of a JNI wrapper -

i have class modbus public class modbus { // init tcp public native void init(string ip, int port, int id); public native short[] read_registers(int slaveid, int addr, int len); the id in init method, printed stdout if execute read_registers if do modbus mb1 = new modbus("192.168.0.250", 502, 1); modbus mb2 = new modbus("192.168.0.250", 502, 2); and then mb1.read_registers(....); mb2.read_registers(....); in both cases prints 2 stdout. seems second instance overwrites first. how can use multiple instances of jni-wrapper? edit: here c code i'm using, goal use multiple connections samre or different modbus devices #include "eu_company_lib_comm_modbus_modbus.h" #include <modbus/modbus-rtu.h> #include <modbus/modbus.h> #include <errno.h> modbus_t *mb; int readerror; int writeerror; int errnr; const char* errstr; int c_id; jniexport void jnicall java_eu_company_lib_comm_modbus_modbus_init__ljava_lang_string

How to create 30 second automated audio clip in Android using Java -

i'm working on side project fun casual use in android studio i'm trying implement button click starts automatic 30 second audio recording user can or whatever in period of time. after clip has finished auto plays , gives ability save or download directly device i haven't started yet, more curious particular methods in api should looking into??? any advice amazing thank you. try this: private mediarecorder mmediarecorder; private static final long update_interval = 100; private sync msync; private boolean misrecording = false; private long mstarttime = 0; private long mstoptime = 0; private string mfilename; private void startrecord() { startrecording(); msync = new sync(new runnable() { @override public void run() { if (!misrecording||!isadded()) return; long currenttime = system.currenttimemillis(); if (currenttime-mstarttime>appconstants.max_record_duration_s*1000){

typescript - Angular 2 issue while Posting Form -

Image
i trying submit form has 2 input field , 1 select list when submit form select list value 0. have clue doing wrong.i post form api getting value correct instead of select list value. html <form class="form-horizontal" id='myform' role="form" [ngformmodel]="inviteuserform" (ngsubmit)="invite(inviteuserform.value)"> <div class="input-group margin-bottom-20"> <span class="input-group-addon"><i class="fa fa-user"></i></span> <input type="text" [(ngmodel)]='inviteuser.username'class="form-control" id="username" placeholder="name" autofocus [ngformcontrol]="inviteuserform.controls['username']" #username="ngform" /> </div>

Is it possible to store generated EMF model directly to CDO? -

from document have followed, understood every element in emf model extend cdoobject. mandatory extend cdoobject? if yes, have emf model developed other team , don't have permission extend model class cdoobject. there alternative solution in such case?? using pure emf-models cdo possible using cdo legacy mode. while supports models not ported cdo has performance implications. you can activate legacy mode this: cdoutil.setlegacymodedefault(true); cdotransaction transaction2 = session.opentransaction(); more information can found here: https://wiki.eclipse.org/cdo/legacy_mode

php - How to remove style.css on specific wordpress page -

i have wordpress child theme in place wp_head(); style.css added like: <link rel='stylesheet' id='parent-style-css' href='http://something' type='text/css' media='all' /> id remove style on specific page (lets page has id=5). i've found how in jquery seems bad idea remove styles client-side. how can remove style via php? possibly using https://codex.wordpress.org/function_reference/wp_dequeue_style on 1 specific page. put code in wp theme functions.php file. should de-queue style files specific pages: add_action('init','_remove_style'); function _remove_style(){ global $post; $pageid = array('20','30', '420');//mention page id not wish include script if(in_array($post->id, $pageid)) { wp_dequeue_style('style.css'); } }

Display marathi font (Indian regional language) in android app -

Image
i have been trying show marathi font using link in app. how not working me. gives no error not show font in text view. came know internationalization concept when first tried this. textview info=(textview)findviewbyid(r.id.textview); typeface face= typeface.createfromasset(this.getassets(), "fonts/fontawesome.otf"); info.settypeface(face); info.settext("typeface");

assembly - ARM GIC v3 configuration to use GICR_ registers -

i trying configure timer interrupt kite processor on fast model. i have enabled gicd enable timer interrupt , updating pending once timer 0 receive cpu interface need enable in gicr. when trying enable in gicr, registers not getting updated when run simulation. updates gicr_igroupr0 register gicr_isenabler0 register not getting updated. does have idea why 1 register able update , not others? do need specific configuration use gicr registers? why 1 register able update? code: #define gicc_offset 0x00 #define gicd_offset 0x00 #define gicr_offset 0x0100000 #define gicr_sgi_ppi_offset 0x110000 // core 0 /* cbar read , offset distributor , cpu interfaces added */ #define gicreg(gic, reg) (*reg32(hal_arm_gic_get_base() + (reg))) /* redistributor control registor gicr_ */ #define gicr_ctlr (gicr_offset + 0x00) /* redistributor sgi , ppi core 0*/ #define gicr_igroupr0 (gicr_sgi_ppi_offset + 0x80) #define gicr_isenabler0 (gicr_sgi_ppi_offset + 0x100) #define gicr_icen

c++ - Building FFMPEG for Visual Studio development -

i'm trying use ffmpeg in visual studio 2013 c++ software (ultimately part of opencv project) - right i'm trying basic ffmpeg functionality. in general, when building in visual studio, build 64--bit software multi-threaded dll runtime libraries. have built ffmpeg using general instructions 'native windows compilation using ... mingw-w64' @ http://ffmpeg.org/platform.html#windows (i provide more detailed set of steps followed below...). after building ffmpeg software on system, tried create simple 'hello world' project in visual studio 2013. specifically, tried implement initial tutorial file presented @ http://dranger.com/ffmpeg/tutorial01.html . upon building project, error: c:\msys64\usr\local\ffmpeg\libavutil\common.h(45): fatal error c1083: cannot open include file: 'libavutil/avconfig.h': no such file or directory the following detailed steps took build ffmpeg , create basic visual studio project: ============ building ffmpeg

ios - Use of undeclared type 'GMSPlacesClient' -

Image
i'm trying implement google auto complete service and, message: use of undeclared type 'gmsplacesclient' i imported google maps module , works gmsmapview... don't understand happening. have same error? picture of error: thank much! i have face same issue. resolve have add pod googleplaces in pod file , update pod. also need replace import import googlemaps import googleplaces

C IDEs: preprocessor-aware code navigation -

background i spend lot of time navigating , editing convoluted scientific c codes. contain hundreds of optional features switched on , off preprocessor directives. makes impossible @ glance whether current block of code activated in current setup or not. code not every feature smudged on place , done using global variables. question is there ide can handle preprocessor directives folding/shading inactive code? i imagine 1 can maintain project config of used flags , work not being bothered inactive branches of logic. looking @ similar question seems eclipse cdt has functionality need , the other question tells can set ifdefs. emacs has similar in form of hide-ifdef-mode . but can try use ide-agnostic solution running code through unifdef , working result. if need read code, it's perfect solution. if need make changes, things become bit more complicated, can use git manage changes, like: import whole code base git run through unifdef commit result, t

Cartesian product of row-indices in Matlab -

i have binary matrix a of dimension mxn m>n in matlab. want construct matrix b of dimension cxn listing row wise each element of cartesian product of row indices of ones contained in a . more clear consider following example. example: %m=4; %n=3; a=[1 0 1; 0 0 1; 1 1 0; 0 0 1]; %column 1: "1" @ rows {1,3} %column 2: "1" @ row {3} %column 3: "1" @ rows {1,2,4} %hence, cartesian product {1,3}x{3}x{1,2,4} %{(1,3,1),(1,3,2),(1,3,4),(3,3,1),(3,3,2),(3,3,4)} %i construct b disposing row-wise each 3-tuple in cartesian product %c=6 b=[1 3 1; 1 3 2; 1 3 4; 3 3 1; 3 3 2; 3 3 4]; you can cartesian product combvec command, example: a=[1 0 1;... 0 0 1;... 1 1 0;... 0 0 1]; [x y]=find(a); b=combvec(x(y==1).',x(y==2).',x(y==3).').'; % b = % 1 3 1 % 3 3 1 % 1 3 2 % 3 3 2 % 1 3 4 % 3 3 4 you can expand unknown

Android emulator does not open in windows 7 -

i have created emulator target android 4.4, if start emulator following exception , not seen emulator. please me emulator works. c:\android-folder\android-sdk\tools\emulator.exe -netdelay none -netspeed full -avd nexus_5x_api_19 emulator: warning: vm heap size set below hardware specified minimum of 96mb init: not find wglgetextensionsstringarb! getgles1extensionstring: not find gles 1.x config! emulator: warning: setting vm heap size 384mb failed obtain gles 1.x extensions string! hax enabled hax ram_size 0x20000000 hax working , emulator runs in fast virt mode. not initialize emulated framebufferwarning: requested ram_size 1536m big, reduced 512m audio: failed create voice `goldfish_audio_in' qemu-system-i386.exe: warning: opening audio input failed console on port 5554, adb on port 5555 emulator: error: not initialize opengles emulation, use '-gpu off' disable it. emulator: warning: ./android/metrics/metrics_reporter_toolbar.cpp:164: can't upload usage metrics:

How to add MAILTO to a cron.d cron_file in Ansible? -

i'm using ansible create cron.d file using cron_file parameter. but how can add mailto file? it seems env=true crontab, not cron.d files. wrong? since ansible 2.0 have cronvar command: # modify /etc/cron.d/sweep_for_rebel_code - cronvar: name: mailto value: vader@evilempire.com cron_file: sweep_for_rebel_code see official documentation @ http://docs.ansible.com/ansible/cronvar_module.html

Clojure: Calling function from script throws RuntimeException -

i'm newbie clojure world coming python background. i have created clojure script problem_1.clj : (defn first_element [arg] (println arg)) (first_element [1, 2]) i have installed clojure via sudo apt-get , running script >> clojure problem_1.clj error exception in thread "main" java.lang.runtimeexception: unable resolve symbol: first_element in context, compiling:(/home/naveen/code/repos/clojure-scripts/problems/problem_1.clj:6:1) any appreciated, thanks. you need add call namespace macro first thing in file. namespace should match name of file, except namespace should use - s, while file must not contain dashes; use _ s instead. namespace should qualified enclosing namespaces; although that's not applicable here. add (ns problem-1.clj) top of file, , check out its documentation

Hot to resolve Redirection Issue in Magento? -

i developing 1 of website on magento platform , website on 1 of demo server 14.15.25.126/xyz when have shifted code on main domain(www.xyz.com) demo link , try open main website in browser redirecting on demo server 14.15.25.126/xyz. please tell me should resolve issue. best regards deepak there configuration inside magento forces redirect . go admin panel , select system tab , select configuration. go b tab , change base urls .

annotations - Users location (blue dot) keeps turning into red pin -

i have users location blue dot while having pins on mapview. pins have annotation has info button. can blue dot users location , enable pins have annotation such title subtitle. when go add info button red pins users location (blue dot) turns red pin. i can't seem spot i'm going wrong. has last function because function puts info button onto annotation. selects users current location , turns pin reason :( class gettothestart: uiviewcontroller, mkmapviewdelegate, cllocationmanagerdelegate { @iboutlet weak var mapview: mkmapview! let mylocmgr = cllocationmanager() override func viewdidload() { super.viewdidload() mylocmgr.desiredaccuracy = kcllocationaccuracybest mylocmgr.requestwheninuseauthorization() mylocmgr.startupdatinglocation() mylocmgr.delegate = self mapview.delegate = self var zoo = cllocationcoordinate2dmake(53.3562, -6.3053) var zoopin = mkpointannotation() zoopin.coordinate = zoo zoopin.title = &quo

ios - Cell of custom tableview using xib file, can not be clicked / selected / tapped -

i have tableview , customized cell using swift. below complete code: class leftmenuviewcontroller: uiviewcontroller { let titles: [string] = ["home", "category", "chat", "notification", "flagger", "feedback", "setting", "log out"] override func viewdidload() { super.viewdidload() let leftmenuview : leftmenu = leftmenu() let nib = uinib(nibname: "leftmenucell", bundle : nil) leftmenuview.tablemenu.registernib(nib, forcellreuseidentifier: "cell") leftmenuview.tablemenu.datasource = self leftmenuview.tablemenu.delegate = self leftmenuview.tablemenu.allowsselection = true leftmenuview.tablemenu.backgroundcolor = uicolor.blackcolor() self.view.addsubview(leftmenuview) } } extension leftmenuviewcontroller : uitableviewdelegate, uitableviewdatasource { func tableview(tablemenu: uitableview, numbero

javascript - Recursion with dynamic arguments -

this question has answer here: variadic curried sum function 7 answers this interview question haven't yet been able figure out. consider following: function recurse(a) { return function(b) { console.log(a + b); } } //this log '5' in console recurse(2)(3); now asked write function take n number of arguments , work same way logging final summation of argument values. meaning: //this should log '13' recurse(2)(3)(1)(7) how can such function written? have tried thinking on in terms of recursion, dynamic arguments etc. haven't been able write down concrete. here's simplest version think of: function add (a) { return function (b) { return b == null ? : add(a+b); } } console.log( add(2)(3)() ); console.log( add(10)(100)(1000)(4)() ); in es6, it's compact! let add =

c# - Ignoring SSL certificate error leads to WebRequest status 406 -

i'm writing own test application api, has own test application, works fine. it ignores certificate errors using system.net.servicepointmanager.servercertificatevalidationcallback = delegate { return true; };// allow ssl peer certificates (for testing only!) when run test app, connects , registers fine. however, when try connect application, response code 406. thing is, both applications same. the real difference is, don't provide gui providing data needed connecting, since hardcode them (just testing). i'm calling same method, use connect button , error code. i have source of api right next me, i'm not allowed publish it. instead, send method causes error code: public wwsvcc_response rawhttprequestbytes(string method, string path, webheadercollection headers, dynamic body) { if (body != null && (body byte[]) == null && (body dictionary<string, dynamic>) == null) throw (new exception("type of parameter \"body\&quo

Ionic 2 - Google Maps working in browser, but not device -

i have following implementation of google maps api (see link below). works when run ionic serve , test in browser. however, when cordova build , deploy apk android 6.0.1 phone, fails. map not load , hangs on loading spinner. if has ideas, appreciate help. thanks https://forum.ionicframework.com/t/google-maps-working-in-browser-but-not-device/58819 solved: i ran following, , low map loads on device too: cordova plugin add cordova-plugin-geolocation

javascript - node-postgres: Update more than one record at once -

i'm building app in node.js using node-postgres. don't know how update more 1 record @ once. here code: var status = 20; var id = [23,12,43]; pool.connect(function(err, client, done) { if(err) { done(); console.log(err); return res.status(500).send(json({ success: false, data: err})); } client.query("update mydatabase set status=($1) id in($2);", [status,id]); but i've got problem - console: events.js:160 throw er; // unhandled 'error' event ^ error: invalid input syntax integer: "23,12,43" what can in case? kind of data use? length of var id not same every time. greetings, rafał edit: think change of data work in javascript, input must 23,12,43, instead [23,12,43] don't know how make that. it looks want use any : client.query("update mydatabase set status=($1) id = any($2);", [status,id]); this due postgresql itself, not library: see this , this se

javascript - AngularJS Filter After One Time Binding in ng-repeat -

i wondering if possible one-time bind variable in ng-repeat directive , filter on variable. my code right unfortuantely performs one-time binding of variable after filtering has been performed, though need binding done before filtering performed. here code: <div flex="20" ng-repeat="item in ::vm.items | filter: vm.itemsearch | limitto: vm.query.limit : (vm.query.page -1) * vm.query.limit"> </div> keep in mind vm.items array potentially 20,000 elements in side, hence need one-time binding. the filters used both searching , pagination. i'd able following: <div flex="20" ng-repeat="item in (::vm.items) | filter: vm.itemsearch | limitto: vm.query.limit : (vm.query.page -1) * vm.query.limit"> </div> however, not valid angularjs syntax due following error: syntax error: token ':' not primary expression @ column 2 of expression. does have way of getting around

How can I convert csv to json file in that form? -

i have csv file sample: 0 -8,396 13,414 -35,891 39,22489124 1 -8,789 12,768 -35,891 39,09516883 2 -9,136 12,768 -35,891 39,17463722 3 -9,614 12,768 -35,891 39,2888623 4 -9,614 12,397 -36,282 39,52844709 5 -9,614 12,397 -36,282 39,52844709 i need convert json file in form: {"0": [-12.770680147058824, 1.846047794117647, -54.265625, 55.77863587895704], "1": [-18.388229927007298, 6.5360401459854014, -52.65647810218978, 56.156491225545878], "2": [-20.042738970588236, 12.849264705882353, -46.678308823529413, 52.399231898471129], "3": [-38.242244525547449, 15.836222627737227, -40.48357664233577, 57.897972254845804], "4": [-33.016879562043798, 6.3001824817518246, -38.179288321167881, 50.867127813832226]} do have idéa how can that? try use tool: http://www.convertcsv.com/csv-to-json.htm play little parameters...

r - I am searching for a minimum in a matrix for every row -

i have matrix in r: [,1] [,2] [,3] "7" "8" "0"... and want have minimum value of every row of matrix without zero. example: in row 1 have values 7,8 , 0. result should 7. thank in advance! we can use rowmins matrixstats after replace ing '0' value na , use na.rm=true expected minimum value per row. library(matrixstats) rowmins(replace(m1, m1==0, na), na.rm =true) or if using base r apply(m1, 1, fun = function(x) min(x[x!=0])) or option pmin after converting data.frame do.call(pmin, c(as.data.frame(replace(m1, m1==0, na)), na.rm = true)) data m1 <- matrix(c(7, 4, 5, 8, 3, 0, 0, 1, 4), ncol=3)

model view controller - in angularjs dropdown data comming from database but not showing in menu -

here im using mvc angularjs here im getting data database why dropdown not display vale values html coding <div class="form-group"> <div class="row"> <div class="col-md-2 col-sm-2" style="margin-left:20px"> <b>country</b> </div> <div class="col-md-8 col-sm-8"> <select ng-model="countryid" ng-options="i.countryid i.countryname in countylist" ng-change="getstates()"> <option value="">country</option> </select> </div> </div> </div> angular code function getcountrys(){ var ddd = mysercive.bindcntrylist(); ddd.then(function (d) { $scope.countylist = d.data; }) } where u calling getcountrys() function? try call when page load via <div ng-init="getcountrys();"> at template,