Posts

Showing posts from January, 2014

javascript - How to get the info about the clicked point of interest? -

Image
how data of location (i.e. lat , lng) clicked? (see image below) i have tried this: google.maps.event.addlistener(marker, 'click', function() { ... }; but event not fired when pressing on restaurant icon (i used the sand example). turns out not-yet-supported feature. these places called points of interest (a.k.a. poi) , custom event cannot assigned yet.

c# - Prevent VS debugger from time out -

i have debug asp.net page takes several minutes execute. problem visual studio internal dev server debugger (i using vs2012) times out before page execution finishes. is there way fix problem? please note not want vstudio attach iis. want know if there way configure internal web development server. thanx in advance! (thanks slaks edit) my cheap, dirty answer send data page during operation. serve keep connection alive appear timing out @ browser level. to handle issue break operation multiple steps: myservice.beginoperation() myservice.updateoperation() myservice.endoperation() where client call methods asynchronously determine application state.

javascript avoid submit if no box checked -

!hello, i have number of checkboxes generated php. there validation button. want prevent user valid form without checking @ least 1 checkbox. i have code var checkboxes = document.getelementsbyname('date[]'); var btn = document.getelementbyid('submit'); date.onchange = function(){ (var i=0;i<checkboxes.length;i++) { if(checkboxes[i].checked) { btn.disabled = false; } else { btn.disabled = true; } } } <form> .... <table> <tr id="{{ cpt }}"> <td><input type="checkbox" class="date" id="date" name="date[]" checked value="{{ jdv.day }}"></td> <td>{{ jdv.day }}</td> </tr> </table> </form> but work first checkbox! can me? thanks your script set button.disabled = true; every checkbox unchecked... means if check...

server explorer - Visual Studio 2013 loses data connections I added -

i haven't been able determine pattern, keep losing data connections i've added in server explorer. i have set of 20-25 databases connect regularly, set them in server explorer don't have each time open ide. how can either prevent loss, or automatically re-add them don't have manually every time vs loses them? i don't remember found information (i'm pretty sure stackoverflow, though) here have done. i open visual studio no project. go server explorer , add databases cd c:\users\\appdata\roaming\microsoft\visualstudio\12.0\serverexplorer make copy of file defaultview.seview then, if ever lose any, can copy backup on defaultview.seview file , back.

c# - Task return value, without Task<T> (async/await pattern) -

i write following: public string getsomevalue() { //directly return value of method 'dosomeheavywork'... var t = dosomeheavywork(); return t.result; } public task<string> dosomeheavywork() { return task.run(() => { // long working progress , return string return "hello world!"; }); } as can see return result dosomeheavywork() have used task.result property, works okay, according researches block thread. i use async/await pattern cant seem find how this. if did same async/await current knowledge end this: public async task<string> getsomevalue() { //directly return value of method 'dosomeheavywork'... var t = dosomeheavywork(); return await t; } public task<string> dosomeheavywork() { return task.run(() => { // long working progress , return string return "hello world!"; }); } this solution doesnt quite fit needs because want return string ...

ios - Get all results of a NSFetchRequest in an NSArray -

in app thing abtain specific value entity nsmanagedobjectcontext *context = [[self sharedappdelegate] managedobjectcontext]; nserror *error = nil; nsfetchrequest *req = [nsfetchrequest fetchrequestwithentityname:@"structure"]; [req setpropertiestofetch:@[@"id_str"]]; [req setresulttype:nsdictionaryresulttype]; nsarray *id_str_bd = [context executefetchrequest:req error:&error]; int way obtain nsarray of nsdictionary ies want directly array of values. what's fast way obtain without loops? i agree tom. values? anyway, can accomplish through kvc. example, nsfetchrequest* fetchrequest = [nsfetchrequest fetchrequestwithentityname:@"structure"]; [fetchrequest setpropertiestofetch:@[@"id_str"]]; nsarray* results = [[self managedobjectcontext] executefetchrequest:fetchrequest error:nil]; nsarray* ids = [results valueforkey:@"id_str"]; nslog(@"%@", ids); notes do not pass nil error. always check ...

beagleboneblack - Package synchronization with opkg -

we're using beaglebone black running angstrom linux , opkg package manager power of our systems. need ensure have consistent , reliable access specific versions of opkg packages. i've set in-house opkg repository. there way sync packages between repositories ? e.g. i'd copy specific packages public / not accessible repositories our internal repository, both speed , reliable access. after fooling around various packages, etc, found way of cloning (parts of) repository using ubuntu system. here's steps took: # install apache sudo apt-get install apache2 # install git sudo apt-get install git # download opkg-utils yocto project git clone http://git.yoctoproject.org/git/opkg-utils # build opkg-utils cd opkg-utils && make; cd - # move them common directory mv opkg-utils /usr/local/share\ # add them path echo "path=\"\$path:/usr/local/share/opkg-utils\"" >> /etc/environment # update environment source /etc/environment # ...

list - Windows Phone 8 equivalent to Androids alert dialog? -

Image
in android project have kind of alert dialog: i want replicate in windows phone 8, haven't been able find suitable plugin/widget so. list populated sharedpreferences. my plan windows 8 use isolated storage files grab required entries, best way? <clippy> it looks want display list user , allow them pick option </clippy> if case can use listpicker wp toolkit. install nuget pack , use such: <toolkit:listpicker fullmodeheader="choose location" itemssource="{binding cities}"> <toolkit:listpicker.fullmodeitemtemplate> <datatemplate> <stackpanel> <textblock margin="0,20" textwrapping="wrap" style="{staticresource phonetextextralargestyle}"> <run text="{binding description}" /> <run text="-" /> <run text=...

Javafx PropertyValueFactory not populating Tableview -

this has baffled me while , cannot seem grasp of it. i'm using cell value factory populate simple 1 column table , not populate in table. it , click rows populated not see values in them- in case string values. [i edited make clearer] i have different project under works under same kind of data model. doing wrong? here's code. commented code @ end seems work though. i've checked see if usual mistakes- creating new column instance or new tableview instance, there. nothing. please help! //simple data model stock.java public class stock { private simplestringproperty stockticker; public stock(string stockticker) { this.stockticker = new simplestringproperty(stockticker); } public string getstockticker() { return stockticker.get(); } public void setstockticker(string stockticker) { stockticker.set(stockticker); } } //controller class mainguicontroller.java private observablelist<stock> data; ...

jquery - Jssor - Changing container background color when image changes -

i using jssor image slider , working perfectly. question is, there way change background color of container image changes? there attribute needs added option section in js? any info related matter appreciated. thank time. there 2 ways work. a. manually set background color each slide <div style="background-color: green;"><img u="image" src="image1.jpg" /></div> <div style="background-color: blue;"><img u="image" src="image2.jpg" /></div> b. place jssor slider in container, , change background-color when slide changed. jssor_slider1.$on($jssorslider$.$evt_park, function (slideindex, fromeindex) { if (slideindex == 0) { //change container background color green } else if (slideindex == 1) { //change container background color blue } });

javascript - Converting data-* attributes to an object -

i'm playing around attr-data-* attributes of html5 , corresponding javascript dataset i'm doing alot of dynamic form processing, end getting stuff this: <input data-feaux="bar" data-fizz="buzz"/> since htmlelement.dataset returns dom string map , way can figure out how convert native object is: var obj = json.parse(json.stringify(input_el.dataset)) is there better way this? edit: why want this? let's have many, many of these elements. want loop through them , push them array processing later, i.e. elements = document.queryselectorall("input") my_data_array = [] for(var = 0; < elements.length; i++) { my_data_array.push(elements[i].dataset) } now have array of objects, i.e. [{feaux: "bar", fizz:"buzz"}....] can work with. however, when don't convert dom string map object, array doesn't populated (i.e. code above doesn't work) edit 2 looking closer, dom string map , not o...

java - Why Event Dispatch Thread can't create new EDT? -

when creating "cnc control" program , wanted create file browser loading or saving drilling plan. made simple file browser , tested [works fine], in main class when actionlistener used construct new edt, ui/jframe freezes , main thread keeps going. nowadays know how go around obstacle using variable(s) in main thread , execute browser them. in short: edt thread right? why can not create event dispatch thread other thread? edit: didn't know there can 1 edt per java application , freezing caused infinite loop inside of it. madprogrammer clearing things up. sorry pile of text below. (my classes difficult separate) here example if english ridiculously bad/i'm confusing you: working main class: import java.awt.borderlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; public class main { //functions: static void loadsavewhatever(){ filebrowser fb=new filebrowser(); ...

How does mongoid know to use plural name of a model when using references? -

i reading mongoid link , , came this: class person include mongoid::document has_many :posts end class post include mongoid::document field :title, type: string belongs_to :person end how mongoid know has_many :posts refers post class? same if has_many :post ? as shows in current mongoid documentation , mongoid uses activesupport::inflector translate between singular , plural model , table names.

android - Phonegap white blink when data-ajax="false" -

in built phonegap html/js app there white blinks when navigating betwen pages on android , ios.using angular , jquery, links have data-ajax="false" no ajax or transitions used.(removed jquery problem didn't solve) i tried: 1.) .ui-page { -webkit-backface-visibility: hidden !important; } 2.) <meta name="viewport" content="width=device-width, user-scalable=no"> 3.) changing default background body{ background-image:url(images/backgrounds/eni0.png) !important; background-size:cover !important; } but nothing above worked. do have more ideas? thanks in advance. if don't use ajax navigation changing 1 html page another, , page navigation blink appear, there nothing can't avoid this, blink due navigation. the options here using ajax navigation, on first page , , display second page content without navigating different html, or using fade out - fade in animations before changing 1 html another, won'...

linq.js to group by array of objects in javascript -

Image
i want use linq.js group following data date. data2 = [{ "date": 1399298400.0, "adid": 1057946139383, "impressions": 1000000 }, { "date": 1399298400.0, "adid": 3301784671323, "impressions": 535714 }...... etc. ]; here's attempt: var linq = enumerable.from(data2); data2 = linq.groupby(function (x) { return x.date; }).select(function (x) { return { date: x.key(), impressions: x.sum(function (y) { return y.impressions | 0; }) }; }).toarray(); however, it's not working correctly because sum of impressions before , after groupby close not identical. what correct way use group in linq.js in case? here's an example in fiddle full dataset here alerts total impressions before , after using groupby . in order access key property of groupby , have within group method. you can passing callback third parameter this: var aggregatedobject = enu...

javascript - AngularJS Expression in Expression -

is there way have angularjs evaluate expression within model data? html: <p> {{txt}} </p> model: { txt: "this text {{rest}}" } { rest: "and rest of it." } the end result be: this text , rest of it . you can use $interpolate service interpolate string... function ctrl ($scope, $interpolate) { $scope.txt = "this text {{rest}}"; $scope.rest = "and rest of it."; $scope.interpolate = function (value) { return $interpolate(value)($scope); }; } <div ng-app ng-controller="ctrl"> <input ng-model="txt" size="60" /> <p>{{ txt }}</p> <p>{{ interpolate(txt) }}</p> </div> jsfiddle

datagridview - Wrong data is taken from data grid view in c# -

i have datagridview1 2 columns , has data in it.... i tried content of rows in second column , place in string array body looping this: for (int j = 0; j < datagridview1.rowcount - 1; j++) { body[j] = datagridview1[1, j].value.tostring(); } so problem is, give me contents of rows in first column instead 1 in second column...what might problem?

AngularJS: Variables "Global" to a Service -

i still working on first angularjs project (learning lot go mimicking existing app) , wos wondering best practices , better techniques. i have service pulls form data sharepoint 365 list. mimicking example able grab data list. concern have duplication of code. every function declares same local variables , change function name , query there lot of duplicity. pulling on 30 lists , have keep duplicating crap until learn correctly. for example, here 2 of "shorter" functions. appiti.service('sharepointjsomservice', function($q, $http){ // priorities this.getpriorities = function(){ var deferred = $.deferred(); jsrequest.ensuresetup(); hostweburl = decodeuricomponent(jsrequest.querystring["sphosturl"]); appweburl = decodeuricomponent(jsrequest.querystring["spappweburl"]); var executor = new sp.requestexecutor(appweburl); executor.executeasync({ url: appweburl + "/_api/sp.appcon...

Unable to link external lib (CLAPACK) using MATLAB mex -

i'm new mex , problem spent me days still cannot figure out do. i create la_test.cpp file test 1 of subroutines in clapck: cgemm_ (complex matrix-matrix multiplication). here code: #include "mex.h" #include "matrix.h" #include <string.h> #include <stdlib.h> #include <malloc.h> #include <iostream> #include <stdio.h> #include "f2c.h" #include "clapack.h" void mexfunction(int nlhs, mxarray *plhs[], int nrhs, const mxarray *prhs[]) { float *xr,*xi; // store input data float *zsr,*zsi; // store output long int m,n; complex *a; xr = (float *) mxgetpr(prhs[0]); xi = (float *) mxgetpi(prhs[0]); size_t k = mxgetnumberofdimensions(prhs[0]); const int *size = mxgetdimensions(prhs[0]); m = mxgetm(prhs[0]); n = mxgetn(prhs[0]); = new complex[m*n]; complex 1 = {1.0f, 0.0f}, 0 = {0.0f, 0.0f}; (int i=0; i<m; i++){ (int j=0; j<n; j++){ complex rc = {xr[j + n*i], xi[j + n*i]}; a[j...

What's wrong with my program (scanf, C++)? -

what wrong program? #define _crt_secure_no_warnings #include <cstdio> using namespace std; int n; char x[110]; int main() { scanf("%d", &n); while (n--) { scanf("0.%[0-9]...", &x); printf("the digits 0.%s\n", x); } return 0; } this console application in vs 2013, here sample input , output: input : 1 0.123456789... output the digits 0.123456789 but when input this output : digits 0 have tried inputitng , manually , text, in code::blocks , vs 2013, neither worked. , when inputting manually, program doesn't wait me input numbers after have entered n. should do? the scanf() in loop fails, didn't notice. fails because can't handle newline before literal 0 . so, fix format string adding space, , code testing return value scanf() : if (scanf(" 0.%[0-9]...", x) != 1) …oops — wrong format… the blank in format string skips 0 or more white spac...

asp.net mvc - How to override some razor views -

asp.net & mono mvc4 application uses razor cshtml views views folders. application deployed number of sites. in customer sites customers want override views add spcific visual design. using specific csss seems to sufficient. how allow override views customer specific views can stored in database. how force razor view engine specific view override in database , use if exists ? if view not found, standard 1 cshtml file should used. or possible add come command standard cshtml files check , switch specific view if exists ? you have create own virtual path provider , custom razor view engine ( inherited default one) following link on that. http://www.umbraworks.net/bl0g/rebuildall/2009/11/17/asp_net_mvc_and_virtual_views http://haacked.com/archive/2009/04/22/scripted-db-views.aspx/ it not related razor surely same. 90% case custom virtual path provide solve problem.

ibm mobilefirst - JVMVRFY013 class loading constraint violated when using xsl on remote test server -

we having issue adapter procedure uses xsl… isolate created new adapter , ran example procedures (getstories, getstoriesfiltered) via procedure invocation via direct http request , via native mobile application (ios). “just in case” both procedures tested both without securitytest attribute , with. in case of getstories (which has no xsl filtering) result returned on both http request , native app. both in local dev wl server , when deployed remote wl test server. in case of getstoriesfiltered (which has xsl filter) on local dev wl server runs fine. adapter deployed remote wl test server error… details are: error invoking browser: / -secure- {"errors":["verify error: java.lang.verifyerror: jvmvrfy013 class loading constraint violated; class=org/apache/xalan/xsltc/dom/saximpl, method=getaxisiterator(i)lorg/apache/xml/dtm/dtmaxisiterator;, pc=0"],"issuccessful":false,"warnings":[],"info":[]} / error invoking n...

Swipe gesture detect via service in android -

how detect swipe event via service sidebar (on android market).... try service layout therefore can able detect swipe gesture main problem layout view have it's own area therefore bad idea detecting swipe event service view... public class gestureswipe extends service { private static final int swipe_min_distance =5; private static final int swipe_threshold_velocity = 10; @suppresswarnings("deprecation") final gesturedetector gt = new gesturedetector(new gesturelistener()); private windowmanager wm; private linearlayout beam; @override public void oncreate() { super.oncreate(); beam = new linearlayout(this); layoutparams lp = new layoutparams(10,layoutparams.match_parent); beam.setlayoutparams(lp); wm = (windowmanager) getsystemservice(window_service); windowmanager.layoutparams mparams = new windowmanager.layoutparams( 10,windowmanager.layoutparams.match_parent, windowmanager.layoutparams.type_phone, w...

How to remove error created using cocos2d-x v2.2.3 (Language cpp) for windows phone? -

i'm trying run game created using cocos2d-x-v2.2.3 (language cpp) windows phone. shows following error. error c2440: 'type cast' : cannot convert 'void (__cdecl startscene::* )(void)' 'cocos2d::extension::sel_cccontrolhandler' if include pch.h file in class file above error removed new error created. error "cannot open include file: 'pch.h': no such file or directory" though pch.h , pch.cpp presented in cocosdenshion. in circumstances should do? in advance i think because use wrong function, fowllow (ccobject:: sel_cccontrolhandler)(ccobject , cccontrolevent) func use must have func(ccobject*, cccontrolevent),

arrays - Octave/GRASS GIS .mat import error: 'map_data' undefined -

i have matlab script calculates terrain-parameter (describing theoretical shelter , exposure wind) based on digital terrain model. script works both in matlab , octave , yields matrix. now: trying couple grass gis shell script. can call script grass, have problems getting output grass. 1 way use .mat format. problem is, however: when export result of calculation (with save -mat4-binary result.mat ans ) , try import .mat file grass, error is: error: no 'map_data' array found in [...file] similarly, when load file in octave , try display load result.mat imagesc(map_data), axis equal, axis tight, colorbar the error error: `map_data' undefined near line 19 column 9 error: evaluating argument list element number 1 when export matlab, same problem. where bug? any appreciated. the "bug" is, mat-file not contain variable named "map_data", guess variable in mat-file named "ans". use res=load result.mat , str...

meteor - Spacebars retrieving template from javascript -

i've migrated meteor 0.8, i'm having headache migrating handlebars spacebars. currently in javascript function, retrieve template , put inside leaflet popup. var marker = new l.marker(...) .addto(map).bindpopup(template.popupform({ data: data })); what equivalent in spacebars ? thank you template.name no longer returns html content, returns template object needs rendered , inserted via meteor's methods. since need pass ready dom element leaflet's method, need create intermediate div. first you'll render template div, can pass leaflet's bindpopup method. code: var div = document.createelement('div'); ui.insert(ui.renderwithdata(template.popupform, { data: data, }), div); l.marker(...).addto(map).bindpopup(div);

clpfd - Prolog arithmetic -

if had following swi prolog queries , answers [a,b,c] ins 1..3, a#= b + c. and needed select below incorrect: a in 2..3, b in 1..3, c in 1..3. would correct in thinking in 2..3 not possible in no case can = 3? actually, constraint does, reduce domains of b , c. since sum must in range 1..3 , , both have range 1..3 . must assume values in range 1..2 . then a in 2..3 it's right answer there.

erlang - How to get binary data into integer on mapreduce in riak -

i working on riak-erlang client , i have done following... 3> mapf = fun(obj,_,_) -> [riak_object:get_value(obj)] end. #fun<erl_eval.18.82930912> 4> 4> {ok, [{0,[r]}]} = riakc_pb_socket:mapred(pid,<<"tst">>, [{map{qfun,mapf},none,true}]). ** exception error: no match of right hand side value {ok,[{0,[<<"2">>,<<"4">>,<<"6">>,<<"3">>,<<"5">>,<<"1">>]}]} how solve issue and how solve these kind of issue {ok, [{0,[s]}]} = riakc_pb_socket:mapred(pid,<<"test">>,[{map, {qfun,maps},none,true}]). ** exception error: no match of right hand side value {ok,[{0, [<<"{\"age\": 24, \"name\": \"krishna\"}">>, <<"{\...

android - webview not cacheing on galaxy grand 2 -

actually i'm making program needs cache website page , if there no connection, should open cached page offline , works fine on galaxy s4, on galaxy grand 2 page not loaded , instead loads default error page here code , in advance help. protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.exchange_app); b= (button)findviewbyid(r.id.button1); tv = (edittext)findviewbyid(r.id.edittext2); webview=(webview) findviewbyid(r.id.webview1); imageview= (imageview)findviewbyid(r.id.imageview1); webview.getsettings().setjavascriptenabled(true); webview.setwebchromeclient(new webchromeclient() { @override public void onreachedmaxappcachesize(long spaceneeded, long totalusedquota, webstorage.quotaupdater quotaupdater) { quotaupdater.updatequota(spaceneeded * 2); } }); webvi...

c# - OneDrive Upload/Download to Specified Directory -

Image
i'm trying use live sdk (v5.6) include backup/restore onedrive in windows phone 8.1 silverlight application. can read/write standard "me/skydrive" directory, having horrible time in finding way upload/download specified directory. can create folder if doesn't exist no problem. i have been trying below no luck. var res = await _client.uploadasync("me/skydrive/mydir", filename, isostorefilestream, overwriteoption.overwrite); i've tried getting directory id , passing in also. var res = await _client.uploadasync("me/skydrive/" + folderid, filename, isostorefilestream, overwriteoption.overwrite); same error.. receive 'mydir' or id isn't supported... "{request_url_invalid: microsoft.live.liveconnectexception: url contains path 'mydir', isn't supported." any suggestions? if suggest answer uploadasync, include how download file specified directory? thanks! c# live-sdk onedri...