Posts

Showing posts from January, 2013

Pass down router to child components via context -

i trying pass down router via context, can call navigateto on child react.component. purpose: need navigate away login when have successful login. strategy: 1. passdown router childe login component. 2. when login call navigateto('/startpage') on router passed down. i have on page/component contains run: router.run(routes, function (handler) { react.render(<handler/>, document.body); }); the following context setup: getchildcontext() { return { router: router }; } and childcontexttypes: childcontexttypes = { router: react.proptypes.object.isrequired }; and child itself: contexttypes = { router: react.proptypes.object.isrequired }; the context setup works fine if using "router: react.proptypes.string.isrequired" . note strings, when using object get: but when try use object errors: warning: failed context types: invalid context 'router' of type 'object' supplied 'navitemlink',

javascript - Foreach loop - hide/show based on click event jquery -

Image
i have list of records in view using foreach. now, want hide/show textbox based on click event on image. code following: @foreach (var dateitem in list) { <td style="width:6%;" id="hourstxt"> @html.textboxfor(modelitem => dateitem.hours, new { id = string.format("txthours"), style = "width:60%;" }) <img id=@( dateitem.project_id + "_" + dateitem.task_id + "_" + "c" + "_img") src="~/images/comment.png" onclick="getcomments(this.id);" /> <div id=@( dateitem.project_id + "_" + dateitem.task_id + "_" + "c") style="border:solid;display:none;"> <textarea id=@( dateitem.project_id + "_" + dateitem.task_id + "_" + "c" + "_text") style="position:absolute;" class="mycomment"></textarea>

Copy constructor C++ -

sorry struggling grasp copy constructors,i know why copy constructor invoked when call object in function value "op.return_value(op)< class operation{ public: int add(int x,int y){ *total=x+y; return (*total); } operation(){ cout<<"this constructor"<<endl; total=new int; } operation(const operation &op){ cout<<"this copy of start"<<endl; total=new int; *total=*op.total; } ~operation(){ cout<<"this end"; delete total; } int *total; int return_value(operation op){ return *total; } }; class child_operation:operation{ public: int sub(int x,int y){ *total=x-y; return(*total); } }; int main() { operation op; child_operation op1; cout<<op.add(5,6)<<endl<<op1.sub(6,5)<<endl; cout<

c# - .Net - Error when get unread mail from Gmail by IMAP protocol -

i'm trying unread mails gmail imap protocol. followed tuto : https://briancaos.wordpress.com/2012/04/24/reading-mails-using-imap-and-mailsystem-net/#comment-4999 , recieved many comments. when call messagecollection messages = mails.searchparse("unseen"); i got error message "index , length must refer location within string". call simple function, don't know what's wrong. more detail, here code snippet: public class mailrepository { private imap4client _client = null; public mailrepository(string mailserver, int port, bool ssl, string login, string password) { if (ssl) client.connectssl(mailserver, port); else client.connect(mailserver, port); client.login(login, password); } public ienumerable<message> getallmails(string mailbox) { return getmails(mailbox, "all").cast<message>(); } public ienumerable<message> getunread

ios - Tableview and UIbutton simultaneously touchdownpress registered input order on which button is let loose first -

the following problem occurs in project, when pressed , hold backbutton (uibarbuttonitem) , tableview row. , letting go tableview row , followed letting go backbutton following error occurs: terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarraym objectatindex:]: index 1 beyond bounds [0 .. 0]'. i have figured out problem here tableview didselectrowatindexpath has wrong indexpath. case: uibarbuttonitem , tableview row pressed , hold simultaneously. in situation 1: uibarbuttonitem letting go , followed letting go tableview row. result: selector uibarbuttonitem called. (in case no error.) in situation 2: tableview row letting go , followed letting go uibarbuttonitem. result: selector uibarbuttonitem called , followed delegate methods of tableview. (in case error above occurs.) - (void)backbutton { self.itemlist = [self getolditem]; [self.tableview reloaddata]; } - (void)tableview:(uitableview *)tableview didselect

java - How to iterate over LoadingCache google class -

i have loadingcache class this: loadingcache<integer, list<parent>> parents where parent class has id , description , home , , nickname i want print values inside parents object i tried like: parents.keys() but couldn't find method loodingcache object you can use method asmap() instead: /** * returns view of entries stored in cache thread-safe map. modifications made * map directly affect cache. */ concurrentmap<k, v> asmap();

How to know when you “log in” to a website using Python's Requests module? -

im doing brute force password script requests module. how can check when have succes login in website? url = sys.argv[1] user = sys.argv[2] file = sys.argv[3] varuser = sys.argv[4] varpass = sys.argv[5] passwords = open(file, "r").read().splitlines() p in passwords: payload = {varuser: user, varpass: p} requests.post(url, data=payload) this depends of website. in general, can search string in text of response: ... r = requests.post(url, data=payload) if 'welcome' in r.text: print('success!') break ...

inno setup - innosetup, uninstall shared service -

i installing , uninstalling service apps via innosetup's code section below. shellexec('', expandconstant('{app}\') + dexename, '/install /silent', '', sw_hide, ewwaituntilterminated, errorcode); .... shellexec('', expandconstant('{app}\') + dexename, '/uninstall /silent', '', sw_hide, ewwaituntilterminated, errorcode); now have seperate application using same service. both applications' installer installs , uninstalls services. i need solution uninstaller should not uninstall if other application still exists on computer. faruk. best regards. both installers should set entry in registry using [registry] section ( http://www.jrsoftware.org/ishelp/index.php?topic=registrysection ) setting flag uninsdeletekey . in both uninstallers can check whether other application still installed doing like if not regkeyexists(hkey_local_machine, 'software\faruk\othersoftwarename') begin

ios - Calculate angle for points of circle that intersect with rect -

Image
i start saying not terribly skilled in maths. please excuse if problem seems trivial you, cant quite wrap head around it. i need distribute , align views on circle given radius , center. no problem , have working great. can specify maximum , minimum angle alignment circle, views distributes on half-circle or similar. to provide better insight, here code: var minangle: double = 270 var maxangle: double = 630 var = 0 let maxindizes = isfullcircle(minangle, maxangle: maxangle) ? subviews.count : subviews.count - 1 subviews.foreach { (subview: uiview) -> () in let angle = getangleforindex(i, max: maxindizes, minangle: minangle, maxangle: maxangle) let radius = double(bounds.width / 2) let circlepos = getpointforangle(angle, radius: radius) let view = uiview() addsubview(view) view.center = circlepos i++ } the problem is, of views have in given rectangle. depending on center of circle, views mi

How to pass parameters in url using php page -

here trying pass id parameter next page using php. i retrieving values database , have id primary key. want pass id next page. when pass parameter through url not appearing on url. how can this? here have done. echo "<a href='product-des.php?'". $row["product_id"].">"; here url visible till.php not able see id after that. what doing wrong here... how can this? to pass parameter echo '<a href="product-des.php?pro_id='. $row["product_id"].'">'; to parameter: echo $_get['pro_id'];

javascript - on specific click of radio button enable text-box/dropdown list in mvc using jquery -

i have 3 radio buttons , 1 dropdown list. on click third radio button dropdown list should appear else should disabled. how check condtion on third radio button based on 'id' property using jquery in mvc. me new jquery.. $("document").ready(function () { //this hide , disable dropdown on page load intially $("#ddsectionlsts").prop("disabled", true); $("#ddsectionlsts").hide(); $('input:radio').click(function () { //this hide , disable dropdown on click of radio button $("#ddsectionlsts").hide(); $("#ddsectionlsts").prop("disabled", true); if ($(this).val=="radiospecific") { //what suitable condtion check //on success of condition dropdown enabled selection $("#ddsectionlsts").show(); $("#ddsectionlsts").prop(&q

javascript - Parse an Array of objects and populate table view cells Swift -

Image
i have app trying pull in data api created ( api based on node.js, mongodb, express.js ) currently trying pull , array of objects , create tableview based on array of objects. example if array of objects contains 4 objects, table view have 4 cells. , on clicking cell go view able view detailed view of object. how can parse returned json data api , populate table view cells? my issue: currently unable parse returned array of objects. below image of returned json contains: the error: i getting following error: error not parse json: optional([ { "_id": "55d1db984f80687875e43f89", "password": "$2a$08$oqb/r9iizdsfln9l5vaie.qilb8gp/ytlsa3s41usvnm/exhbw9j6", "email": "syed.kazmi26@gmail.com", "__v": 0, "sector": "manufacturing", "jobtitle": "something 1", "employeename": "something 1" },

java - Android Studio Apache functions -

i've been trying create defaulthttpclient object with: httpclient client = new defaulthttpclient(); but i'm unable find class can't resolved in android studio. after googling class, first result shows following url: link and it's 404: not found page. does know how can use function , similar function such httpget? use urlconnection. if remember correctly, defaulthttpclient deprecated. url url = new url("http://stackoverflow.com"); urlconnection conn = url.openconnection(); inputstream in = new bufferedinputstream(conn.getinputstream());

c++ - Return error while trying to compile fftw -

it newbie in c++ question. trying apply fft complex 1d data using fftw. # include <stdlib.h> # include <stdio.h> # include <time.h> #include <fftw3.h> int main(void) { int i; int n=100; fftw_complex *in; fftw_complex *out; fftw_plan plan_forward; unsigned int seed = 123456789; in= (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*n); out= (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*n); srand ( seed ); ( = 0; < n; i++ ) { in[i][0] = rand ( ); in[i][1] = rand ( ); } plan_forward = fftw_plan_dft_1d ( n, in, out, fftw_forward, fftw_estimate ); fftw_execute ( plan_forward ); ( = 0; < n; i++ ) { printf ( " %3d %12f %12f\n", i, out[i][0], out[i][1] ); } fftw_destroy_plan ( plan_forward ); fftw_free ( in ); fftw_free ( out ); return; } after compiling getting error: error: return-statement no value, in function returning ‘int’ [-fpermissive]

html - Slider images with dynamic width and height -

i want incorporate rotating slider website in order have occupy whole screen on different devices mobile/desktop needs have width:100% makes image not visible. i'm using code library http://demo.tutorialzine.com/2010/11/rotating-slideshow-jquery-css3/ , i've setup demo on http://jsfiddle.net/9mmzf7wh/1/ i've tried setting width:auto , width:100% i made quite few changes, gist of absolute positioning of #slideshow , removal of bunch of margin and/or padding statements had in place. #slideshowcontainer { background: pink; overflow: auto; padding-bottom: 70%; height: 0; position: relative; } #slideshow { top: 0; bottom: 0; left: 0; right: 0; position:absolute; background-color:#fff; z-index:100; -moz-box-shadow:0 0 10px #111; -webkit-box-shadow:0 0 10px #111; box-shadow:0 0 10px #111; z-index: 1; } #slideshow ul { list-style:none; overflow:hidden; } demo

java - How can I send the data from a imput type="file" to the controller? -

i have in ftl: <input type="file" id="doc6" name="documente"> in .js: var lx = $("#longx").val(); var ly = $("#laty").val(); var jud = $("#judetpunctlucru").val(); var doc6type = $("#doc6type").val(); var doc6 = $('doc6').val(); validatecoords: function (lx, ly, jud, doc6type, doc6) { var data = { lx: lx, ly: ly, jud: jud, doc6type: doc6type, doc6: doc6 }; var url = contextpath + '/validarecoord'; return getjsondata(url, data); } and in controller: @requestmapping(value = "/validarecoord", method = requestmethod.get, produces = mediatype.application_json_value) @responsebody public map<string, object> getvalidcoord(@requestparam("lx") string lx, @requestparam("ly&q

Converting a list to a data frame making each nested element a column in the df using r -

using r: i have list of 100 this: [[1]] b st1 2 3 st2 4 10 st3 5 6 [[2]] b st1 4 8 st2 5 2 st3 20 10 until 100... in same structure. know how combine them df fall 3 columns vertically. however, want this: a1 b1 a2 b2... a100 b100 st1 2 3 4 8 st2 4 10 5 2 st3 5 6 20 10 does know how this? thanks lot! we can use do.call(cbind convert list of data.frames single data.frame df1 <- do.call(cbind, lst) colnames(df1) <- make.unique(colnames(df1)) or colnames(df1) <- paste0(colnames(df1), rep(seq_along(lst), each=length(lst))) df1 # a1 b1 a2 b2 #st1 2 3 4 8 #st2 4 10 5 2 #st3 5 6 20 10 or simply df1 <- data.frame(lst) and change column names.

android - NestedScrollView and WebView -

i have got nestedscrollview webview inside , using collapsing toolbar. <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.nestedscrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="fill_vertical" > <webview android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v4.widget.nestedscrollview> when load content of webview , content have got more height screen, works great. toolbar hiden/show on scroll. second situation when content of webview small. when hang nestedscrollview @ bottom , drag top, toolbar hiden , drag bottom toolbar shown. when trying drag webview isn't work, view still in same place. any idea ho

php - Scope of setlocale function? -

i want sort array in php contains german 'umlaute'. not seem easy task php. found following example on web: $oldlocale=setlocale(lc_collate, "0"); setlocale(lc_collate, 'de_de.utf8'); usort($countrys, 'strcoll'); setlocale(lc_collate, $oldlocale); this working expected. question is, scope of setlocale? limited current function in, limited thread, session or global? i afraid of creating race conditions, cannot find other information on than: the setlocale() function sets locale information. it global setting, keeps set last value while script running. it's not related sessions, it's scope php process itself. http://php.net/manual/en/function.setlocale.php

c++ - Why can't I specialize with a nullptr template parameter on a dependent type? -

this question has answer here: (partially) specializing non-type template parameter of dependent type 4 answers i'd make specialization of struct 1 uses function pointer , doesn't. when this: template <typename t, t*> struct test; template <typename t> struct test<t, nullptr> { }; template <typename r, typename...args, r(*fn)(args...)> struct test<r(args...), fn> { }; i error: error: type 't*' of template argument 'nullptr' depends on template parameter struct test<t, nullptr> what mean , how make work? the linked question describes main issue , solutions, since involved i've applied them particular problem. version 1 we can use std

php - Symfony Sonata admin find by some field -

i install sonataadminbundle , create controller extends admin , function configureformfields, configuredatagridfilters, configurelistfields. , in field list use field image see url image, image live in amazon s3 want see image in table. how this? , have filter find colums, entity developer have array skill , 1 skill find how find 2 or many skill ? and add admin can upload avatar developer in action(not extends admin) upload for(field image in developer = string , set url s3) $url = sprintf( '%s%s', $this->container->getparameter('acme_storage.amazon_s3.base_url'), $this->getphotouploader()->upload($request->files->get('file'), $user_company_name) ); $user->setimage($url); how can sonata, reload controller? how ? this action: class developeradmin extends admin { protected function configureformfields(formmapper $formmapper) { $formmapper ->add('firstname', null, a

Docker image versioning and lifecycle management -

i getting docker , trying better understand how works out there in "real world". it occurs me that, in practice: you need way version docker images you need way tell docker engine (running on vm) stop/start/restart particular container you need way tell docker engine version of image run does docker ship built-in commands handling each of these? if not tools/strategies used accomplishing them? also, when build docker image (via, say, docker build -t myapp . ), file type produced , located on machine? docker has need build images , run containers. can create own image writing dockerfile or pulling docker hub. in dockerfile specify image basis image, run command install things. images can have tags, example ubuntu image can have latest or 12.04 tag, can specified ubuntu:latest notation. once have built image docker build -t image-name . can create containers image `docker run --name container-name image-name. docker ps see running containers do

uiwebview - iOS webview load another url with Safari -

i making app ios, use uiwebview load website in app. want links (besides website) open in safari. read many articles , tried many different suggestion still can't make it. i not familiar in coding, use xcode 6.3.2 here code of viewcontroller.m: #import "viewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; nsstring *fullurl = @"http://www.mywebsite.com"; nsurl *url = [nsurl urlwithstring:fullurl]; nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; [_viewweb loadrequest:requestobj]; } - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { // check if click event , other criteria determining if want launch safari. if (navigationtype == uiwebviewnavigationtypelinkclicked && [ [ request.url scheme ] isequaltostring: @"http" ]

visual studio - Errors resolving NuGet Packages after TFS Download -

Image
i'm having strange problem of nuget packages aren't resolving after full download of solution team foundation server in vs2015 pro. the solution working before + trying install packages again vs reckons exists. any ideas? my suggestion firstly latest on project , if doesnt work reinstall projects packages using package manager on project. uninstall-package simplecrypto install-package simplecrypto uninstall-package microsoft.owin install-package microsoft.owin uninstall-package owin install-package owin uninstall-package entityframework install-package entityframework https://www.nuget.org/packages/simplecrypto/ https://www.nuget.org/packages/microsoft.owin/ https://www.nuget.org/packages/owin/ https://www.nuget.org/packages/entityframework

Receive NFC/NDEF message from Android phone to Raspberry Pi -

i have android app sends ndef message containing few words. can receive message on android device able receive message on raspberry pi. or ndef message exchange android android thing? i have searched on google , found possible way requires install android on raspberry pi i'm not 100% sure work. have raspberry pi model b+. no, nfc not limited android devices. can implement nfc communication pretty device has nfc front-end. raspberry pi not have 1 default. however, there exist various add-on tools use add nfc rpi, e.g. explore-nfc nxp: http://www.nxp.com/board/pnev512r.html adafruit pn532 break-out board: https://www.adafruit.com/products/364 instead, use usb nfc reader, acr122u, rpi. in order softwre support nfc, use libraries provided boards or possibly libnfc . once have nfc support on rpi, there various ways exchange ndef messages android device (which of them work depend on nfc front-end chose): implement peer-to-peer protocol stack , snep protocol e

Animation is too fast in Three.js -

i'm loading model , skeletal animation using colladaloader three.js , appears doing right movements far can tell, animation ridiculously fast reason. how control speed of animation? var animation = three.animation( mesh, animationdata ); animation.timescale = 1/5 ; // add the default timescale 1, reduce lower animation

python - Dynamically generate one value in a Django include tag -

i have include tag works fine if hard code values, need generate on fly using {{ foo_counter }} . doing way: {% include "template.html" foo=var1 pos="var_num_{{foo_counter.next}}" bool="0" %} just outputs string without interpreting variable (as expect). i've tried combinations of tag around either template error or same output. you can use django's inbuilt add filter: https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#add {% include "template.html" foo=var1 pos="var_num_"|add:foo_counter.next bool="0" %}

ios - MagicalRecord with NSOperation causing persistence issues -

i'm using magicalrecord manage core data. app receives chunks of data needs iterated on individually added store records, , saved. put code nsoperation. looks this: class addincomingmessageoperation: nsoperation { override func main() { let context = nsmanagedobjectcontext.mr_context() self.message = message.createmessage( json: self.messagejson, context: context) if self.message != nil { context.mr_savetopersistentstoreandwait() } } } running on nsoperationqueue.mainqueue seems work without issue, other holding ui. next move run of these operations on own background operation queue. adding them nsoperationqueue , running them results in mixed data. what mean - createmessage function checks existing conversation object, , adds conversation if exists, or creates 1 if doesn't. requires knowing exists in store. seems happening how, them running on background queue, they're creating conversa

xcode - Adding a framework to Watch OS 2 framework -

i "undefined symbols architecture" error frameworks add watch os 2 framework bundle in xcode 7 beta 5. facing same problem? are trying run watch app on real device or simulator? if it's real device seems have bad news according thread: https://forums.developer.apple.com/thread/11714 i've struggled lot embedded watch frameworks on beta 4/5 , ended no luck. had move files framework directly watch extension. i'm waiting fix in beta 6.

c# - EntityFramework 6 and mongodb and Identity -

i using webapi project , setup entityframework 6 mongodb. i have setup mongodb database , entity framework code first model following link: http://cdn.rssbus.com/help/dg1/ado/pg_efcodefirst.htm now entity framework , asp.net identity 2 work based on mongodb. however, cannot find way ormodules allow it. found following explains uninstall entity framework. https://github.com/g0t4/aspnet-identity-mongo so know tuorial or have experiences enable mongodb ef code first , identity working with? thanks, ok found solution. i not using ef anymore. i using aspnet identity mongo v2 branch compiled. https://github.com/inspectorit/mongodb.aspnet.identity/tree/v2 i using mongorepository repository of model. https://github.com/robthree/mongorepository and have developed dataservice manage models crud operations. public class dataservice { public static mongorepository<modelclass> modelclass{ { return singleton<mongorepository<modelclass>>.i

perl Net::IMAP::Client how to get unseen emails -

i using net::imap::client code: my $imap = net::imap::client->new( server => 'imap.server.com', user => $user, pass => $pass, ssl => 1, # (use ssl? default no) ssl_verify_peer => 0, # (use ca verify server, default yes) #ssl_ca_file => '/etc/ssl/certs/certa.pm', # (ca file used verify server) or # ssl_ca_path => '/etc/ssl/certs/', # (ca path used ssl) port => 993 # (but defaults sane) ) or die "could not connect imap server"; $imap->login or die('login failed: ' . $imap->last_error); $imap->select('inbox'); then tried: my $status = $imap->status(inbox); now have hash this: name : inbox uidnext : 312 messages : 298 recent : 0 unseen : 1 uidvalidity : 1420542773 now want text of 1 unseen e-mail. read documentation didnt find how that. thanks lot. i

visual studio - Equivalent of the GetTempPath on Windows Phone -

i compiling third party library libkml windows universal app. , notice following win32 api not available on winapi_partition_desktop . the following fileapi.h : #if winapi_family_partition(winapi_partition_desktop) winbaseapi dword winapi gettemppathw( _in_ dword nbufferlength, _out_writes_to_opt_(nbufferlength, return + 1) lpwstr lpbuffer ); ... #endif does know equivalent function gettemppath windows store app , windows phone app? here example gettemporarydirectory() wrapper function taken following msdn blog article " writing shared code windows store , win32 desktop apps ": dual-use coding techniques games, part 3 . void gettemporarydirectory( wchar_t* dir, size_t maxsize ) { if ( !maxsize ) return; *dir = 0; #if !defined(winapi_family) || (winapi_family == winapi_family_desktop_app) dword nchars = gettemppath( maxsize, dir ); if ( nchars > 0 ) dir[nchars-1] = '\0'; // trim trialing '\'

Youtube v3 API Python Transition to live -

i trying transition broadcast event testing , live using youtube live api v3 python 2.7.3. used example code in youtube documentation web create broadcast, streaming , bind them need transition , there no example of in documentation. trying using code: def bind_transition(youtube, broadcast_id): transition_state_response = youtube.livebroadcasts().transition( part="status", id=broadcast_id, broadcaststatus="testing" ).execute() please can correct code or give me example this. i had not written main..., defined function not using it, adding code solved problem: try: bind_transition(youtube, broadcast_id) except httperror, e: print "an http error %d occurred:\n%s" % (e.resp.status, e.content)

algorithm - What is the time complexity for finding the maximum value less than a given value? -

any data structure know of orders data, has, @ best, o(log n) lookup. i argue find maximum value less given value, need first discover given value live in data structure. (i have no proof required first step). that requires o(log n) time. from there, need find maximum value less that. in case of array, 1 index o(1). in case of balanced tree, traverse path typically o(log n). in case, seems average total time complexity must o(log n). is correct, or can somehow better? no, there no more efficient comparisons based algorithm. worst case indeed bounded omega(logn) using comparisons based algorithms, since there n possible outputs (all of them can achieved given correct query), , choose 1 of them computation tree must of height log(n) . gives lower bound of omega(logn) problem using comparisons, regardless of data structure used. this bound tight, since in sorted array, 1 can find desired value using binary search in o(logn) .

ajax - Why does AngularJS $http .success promise work but .then doesn't? -

i've been using following code doing ajax calls in angular worked fine far: function getdata (url) { var deferred = $q.defer(); $http.get(url, { cache: true }).success(function (data) { deferred.resolve(data); // works }); return deferred.promise; } as can see there success handler. when wanted add error handler, noticed docs state success , error depracated , should not used more ( https://docs.angularjs.org/api/ng/service/ $http). instead .then promise should used, changed code this: function getdata (url) { var deferred = $q.defer(); $http.get(url, { cache: true }).then(function (data) { deferred.resolve(data); // not called :( }, function () { deferred.resolve(false); // not called :( }); return deferred.promise; } now stopped working. .then never called. why? i'm on latest angular version 1.4 ok, found problem. actually, there 2 problems. first, had redundant promis

xampp - AMPPS cannot stop MySQL -

i clicked stop button in ampps, cannot stop mysql running. tried run admin, did not work well. i running on windows, , stop button used work. now, have run following command stop server. "mysqladmin -u root shutdown" did change root password?

java - Out of the sudden (after an Android SDK Manager packages update) an Apache import stopped resolving -

i using android studio, opened sdk manager , downloaded new updates , apis. then closed it. i opened eclipse (another older project there) , out of sudden project wouldnt compile anymore: the import org.apache.http.util cannot resolved the developer had worked on project before using class package - encodingutils in following way: string postdata = "token=" + token + "&url=" + url; webview.posturl(api.getapploginurl(), encodingutils.getbytes(postdata, "base64")); why package import stop resolving out of nowhere? replace encodingutils.getbytes method with? turns out, when hovered on encodingutils (cannot resolved), 1 of suggestions fix project setup taken window offered add android.jar project setup, did , problem disappeared!

mvvm light - Mvvmlight and Xamarin.iOS unable to find default ctor -

i have project running fine on android , winphone 8. when attempt run on ios, i've getting following error microsoft.practices.servicelocation.activationexception: cannot register: no public constructor found in x where x whatever simpleioc.default.register<t, tu>(); flow hits first. i've moved code around (as suggested elsewhere) ensure of platform specific simpleioc calls made in viewmodellocator . i've added public default ctors in classes complaining error (i have though set preferredconstructor original, not newly added public ctor). i have feeling error false positive (something else failing, pointing @ code). using xam.ios via build server (the code coming vs2015). xcode running 8.3 emulators (it may need updating allow 8.4 testing) it linker optimising away constructor, if thinks it's not used. try setting linker options "don't link" , see if again, or new-up instance of class elsewhere linker knows constructo

Does the time reported in z3 (v4.4.0) statistics include the time required to read the SMT constraint file? -

or purely solving time? question case when z3 being called external binary. asking in of examples, constraint solving time small , suspect become comparable file read time. also, how accurate total-time small values (< 1s example)? yes, total time should include time need read problem. numbers 'reasonably' precise, not totally exact. in our own performance experiments, use higher precision external timers, don't need measure load time. if you're getting region load time , solving time both small, best switch api instead of dumping .smt2 files , calling external binary.

Java, defining a method -

i'm new programming....not sure how add / define methods lower half of program work. import static java.lang.system.out; import java.text.*; import java.util.*; import java.lang.*; public class dates { // --- add methods here make program work --- // // attempted solution nameformat method!!!!!! //keep getting "cannot find symbol - variable nameformat //or cannot convert string int error if give return value //have scoured internet examples , can't figure out. public static int nameformat(int year, int month, int day) { simpledateformat nameformat = new simpledateformat("yyyy, mm, dd"); date date = nameformat.parse("2014, 10, 4"); simpledateformat sdfdestination = new simpledateformat("mmmmm dd, yyyy"); return nameformat < not sure put here; } public static void printdate(int year, int month, int day) { out.println(nameformat(year, month, day)); out.pr

zend framework - Fatal Error Zend_Uri Magento -

suddenly our magento store has fatal error: php fatal error: class 'zend_uri' not found in /.../public_html/app/code/core/mage/core/model/store.php on line 726 no new plugins or modules have been added recently. compiler not active, var/cache , var/session empty. permissions resetted magento folders / files. no other errors or more information provided, have blank page - on frontend , backend. magento version 1.7.0.2. appreciated. line 726 of store.php file looks this #file: app/code/core/mage/core/model/store.php $uri = zend_uri::factory($securebaseurl); that is, magento's making call static method factory on zend_uri class. error php fatal error: class 'zend_uri' not found indicates php can't find zend_uri class. because the class definition file no longer there, someone has changed class definition file it's no longer valid a local code pool override file exists , has edited class override file it's no lon

excel - Copying values across a dynamic column and row range -

i have following code that: copies column headings (in row 1) column c across second last column pastes these column headings in row 1 in column 2 across last column data pastes column headings alongside each row of data through bottom row sub gldr() 'use end(xlup) determine last row data, in column of gldryypp tab dim lastrowdr long lastrowdr = sheets("gldryypp").range("a" & rows.count).end(xlup).row 'copy cost type categories , paste alongside cost centres ctnamecol = "s2:af" & lastrowdr sheets("gldryypp").range("c1", range("c1").end(xltoright).offset(0, -1)).copy sheets("gldryypp").paste destination:=sheets("gldryypp").range("c1").end(xltoright).offset(0, 2) sheets("gldryypp").range(range("c1").end(xltoright).offset(0, 2), range("c1").end(xltoright).offset(0, 2).end(xltoright)).copy sheets("gldryypp").paste destination:=shee

How can I launch a C++ native application from a Windows Service main function (the application interacts with the console)? -

i'm using _spawnl() function launching c++ native application main service function ( svcmain ), application never gets run. is there trick launch applications interacts user? it runs, cannot see it. have use createprocessasuser() instead of _spawnl() new process runs in specific user's session, not in service's own session. in vista , later, services run in own isolated sessions (session 0 isolation), users cannot see or interact with. common solution use wtsgetactiveconsolesessionid() and/or wtsenumeratesessions() find desired user session, use wtsqueryusertoken() token hanlde can used createenvironmentblock() , createprocessasuser() . also, when providing startupinfo createprocessasuser() , set lpdesktop field "winsta0\\default" (the user's default desktop can interact after logging in).

android - inter fragment Communication -

my question if com reference of interface communicater why used getactivity(); in com = (communicater)getactivity(); .. thanks public class fragmenta extends fragment implements view.onclicklistener{ button button; int counter; communicater com; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { return inflater.inflate(r.layout.fragment_a,container,false); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); button = (button) getactivity().findviewbyid(r.id.button); com= (communicater) getactivity(); button.setonclicklistener(this); } @override public void onclick(view v) { counter++; com.respond("this button clicked "+counter+" times"); }

java - org.mockito.exceptions.misusing.InvalidUseOfMatchersException when trying to create custom argument matcher -

i’m using mockito 1.10.18. i’m trying create custom argument matcher method has following signature … saveresult[] com.sforce.soap.enterprise.enterpriseconnection.update(sobject[] sobjects) throws connectionexception i have written following custom argument matcher … class accountmatcher extends argumentmatcher<sobject[]> { private set<string> idlist = new hashset<string>(); accountmatcher(final set<account> mainlist) { (final account acct : mainlist) { idlist.add(acct.getid()); } // } public boolean matches(object param) { final sobject[] compset = ((sobject[]) param); final set<string> compidlist = new hashset<string>(); (final sobject acct : compset) { compidlist.add(acct.getid()); } // return util.twosetsmatch(compidlist, idlist); } // matches } however, when try , set in junit test … final se

c++ - OpenCV: Dealing with contour vector indexing -

using function convexitydefects takes blob binary image , creates vector points surrounding hand. vector begins @ point @ highest y location on blob interfering ability run k-curvature on each finger determine accurate finger position. i have thought reshuffling vector beginning of vector starts away location away fingers on hand. problem difficult implement because don't have effective way pick point on hand start reordering of points. have suggestions provide easy methods fix this? goal have none of fingertips within ~30 points of beginning of array.

apache - vhosts without SSL cert setup redirect to other vhosts that use SSL -

i'm running apache on multi-tenant server vhost sites configured. so have vhost domain1.com has ssl cert defined in vhost file. have domain2.com not have ssl cert defined. if visit https://domain2.com , browser pulls website domain1.com, of course displays broken ssl cert warning in browser. the way i'm trying correct is: first, in vhost.conf file domain2 i've put this: <virtualhost ip:443> servername domain2.com documentroot /var/www/domain2/ sslengine on sslcertificatefile /var/certs/cert.crt sslcertificatekeyfile /var/certs/cert.key redirect permanent / http://www.domain2.com </virtualhost> of course client doesn't own own ssl certificate, i'm pointing certificate file 1 of our domains. in instances gives certificate warning user when visit https://www.domain2.com or https://domain2.com . (in chrome can go https://domain2.com , redirected without warning) of course generating self-signed cert use purpose thro

filter - Java Streams - Filtering on previously filtered values -

i experimenting java's streams , trying figure out possible strengths , weaknesses. trying implement sieve of eratosthenes using stream, cannot seem find way loop through filtered values without storing them in separate collection. i wanting accomplish this: intstream mystream = intstream.range(0,3); mystream.filter(s -> { system.out.print("[filtering "+s+"] "); mystream.foreach(q -> system.out.print(q+", ")); system.out.println(); return true; //eventually respond values observed on line above }); with desired output of: [filtering 0] [filtering 1] 0, [filtering 2] 0, 1, [filtering 3] 0, 1, 2, note while filtering each new value filtered values observed. allow easy implementation of sieve of eratosthenes because filter out non-prime values , each new value check divisibility against numbers have passed prime filter. however, above example gives me error in netbeans: local variables referenced lambda expressi

javascript - How to add data to a json file? -

i have json file (it mock object works database users): [ { "id": "0", "username": "aaaaaaaaa", "password": "xxxxxxxxx", }, { "id": "1", "username": "bbbbbbbbb", "password": "yyyyyyyyy", }, { "id": "2", "username": "ccccccccc", "password": "zzzzzzzzz", } ] i need add new users in json file. tryed use fs.appendfile function, append user after square bracket. how can it? you should load json file in memory, update array , save back. like: var users = json.parse(fs.readfilesync('yourfile.json', 'utf8')); users.push({ "id": "10", "username": "blabla", "password": "passpass", }); fs.writefilesync('yourfile.json', json.stringify(users));

notifications - how to get regID using pushwoosh android native SDK -

i using pushwoosh android native sdk push notifications. want reuse regid provided gcm on successful registration. how can regid using android native sdk ? when regid gcm registration, store in sharedpreferences access later. to store it googlecloudmessaging gcm = googlecloudmessaging.getinstance(getapplicationcontext()); string regid = gcm.register(id); sharedpreferences shp = getapplicationcontext().getsharedpreferences("prefkey", getapplicationcontext().mode_private); shp.edit().putstring("regid",regid).commit(); to it sharedpreferences shp = getapplicationcontext().getsharedpreferences("prefkey", getapplicationcontext().mode_private); if (shp != null && shp.contains("regid")) regid = shp.getstring("regid", null);

python - Improve loop efficiency -

i have 21,000 rows i'm pulling sqlite3 database, , need put dictionary appended array. loop takes 1.531 seconds, , i'm trying minimize as can. what's faster way can this? (i using python 2.7.3) results = cursor.fetchall() array = [] row in results: = {} b = row[11] c = str(row[8]) d = str(row[9]) + " ? " + str(row[10]) e = row[3] f = row[4] key = e + " - " + f rowtoadd = { 'aaa': row[3], 'bbb' : row[0], 'ccc' : row[1], 'ddd' : row[12], 'eee' : row[2], 'fff' : row[9], 'ggg' : row[1], 'hhh' : str(row[6]) + " (" + str(row[5]) + ")", 'iii' : e, 'jjj' : d, 'kkk' : f } rowtoadd.append(array) is there way directly map cursors output list of diction

jquery - Hide default title tooltip -

Image
we can see above images, on hover of "create" button, 2 tooltips coming. here dont want default tooltip (small 1 below). i want show customize tool tip my code: <style> button[title]:hover:before { content: attr(title); padding: 2px 2px; color: #333; position: absolute; left: 100px; top: 320px; z-index: 20; white-space: nowrap; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; -moz-box-shadow: 0px 0px 4px #222; -webkit-box-shadow: 0px 0px 4px #222; box-shadow: 0px 0px 4px #222; background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc)); background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc); background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); background-image: -ms-linear-gradient(top, #eeeeee, #cccccc); background-image: -o-linear-gradie

office365 - Using ADAL JS Lib in JS App -

i need use adal js lib office 365 add-in. went through github page here . saw example given in form of angular js app. there example can used in plain js app. office add-in created napa dev tools generates basic skeleton , building app on top of it. think angular js better option build outlook office add-in? i plan use outlook 365 rest apis in app, before doing need authentication module working. need token can pass on endpoint in order execute rest apis. please correct me if approach seems in wrong direction , let me know if more information needed. thanks! adal js built spas in mind, why made angular module. have 2 options here, depending on how comfortable angular are. build out add-in angular app. you'll able use adal js it's documented here . don't use angular , don't use adal js. it's oauth underneath, can use whatever you'd handle that. can see example on how request access token azure without angular here . good luck!

Why does my VSIX not install on Visual Studio Professional? -

i have created vsix supposed installable on either visual studio 2013 professional or higher and/or visual studio 2015 community or higher. when people install visual studio 2013 professional following error on log (relevant bits): supportedframeworkversionrange : [4.5,) supported products : microsoft.visualstudio.community version : [12.0,) references : searching applicable products... found installed product - microsoft visual studio professional 2013 found installed product - microsoft visual studio 2013 shell (integrated) found installed product - global location found installed product - ssms vsixinstaller.noapplicableskusexception: extension not installable on installed products. @ vsixinstaller.app.initializeinstall() @ system.threading.tasks.task.innerinvoke() @ system.threading.tasks.task.execute() i have taken out dates on left. i thinking 'microsoft.visualstudio.community', version : [12.0,) have supported 'microsoft visual studio profess

android - AndroidViewClient restarts device with every command after using "touch(x,y)" command once -

Image
using androidviewclient, every action try make using culebra or of associated scripts restarts virtual device. has ever run before? **edit 1: ** more specifically, endless restart loop after trying command touch device in specific area. i.e. if place following script, restart device , further culebra generated commands cause device restart self.vc.device.touchdip(173, 1111) edit 2: added more information i've replicated behavior on few different models, i'm working following: device: google galaxy nexus - 4.3 - api 18 - 720x1280 $ culebra -v culebra 10.7.2 $ dump -v dump 10.7.2 dump android.widget.framelayout android.view.view com.android.launcher:id/workspace android.view.view com.android.launcher:id/cell3 android.appwidget.appwidgethostview android.view.view com.android.deskclock:id/analog_appwidget android.widget.textview camera .... $ adb shell date thu aug 20 12:44:08 edt 2015 different x,y coordinates restart device wel

How to make a back-to-top button using CSS and HTML only? -

what i'm trying kind of back top button scroll down , point on page! instance have long text , want bring user next paragraph having him click on link... i've done in past can't remember how did life of me... what want put "anchor" @ top of page, using <a> tag (it's not useful links!). then, when have link goes #nameofanchor , scrolls anchor name. you'd this: <a name="top"></a> <!--content here--> <a href="#top">back top</a> here working jsfiddle: http://jsfiddle.net/qf0m9arp/1/

android - Show dialog in hooked method by xposed running in thread -

i try show alertdialog within hooked method xposed. problem method running in threads, , thread running in thread, etc... for example : activity -> thread -> thread -> ... -> function is there way show alertdialog ? have context, since hooked function not in main thread, useless. edit (some code) : public class xposed implements ixposedhookloadpackage { private context ctx; private queue<string> queue = new linkedlist<>(); public void handleloadpackage(final loadpackageparam lpparam) throws throwable { if (!lpparam.packagename.equals("xxx.xxx.xxx")) { return; } // here context static class extending application findandhookmethod("xxx.xxx.xxx", lpparam.classloader, "attachbasecontext", context.class, new xc_methodhook() { @override protected void afterhookedmethod(methodhookparam param) throws throwable { xposedbridge.log("context modified"); ctx

swift - Odd EXC_BAD_ACCESS when calling contactTestBetweenBody -

i have 3d scene created in scene kit comprising area surrounded invisible walls , want lob physics objects area in such way can't escape once they're in. had mind achieve in following fashion: create wall object create 'solidifier' fits neatly inside walls set each object's isinscene variable false lob them in vague direction of solidifier upon each update, if object touching solidifier not touching walls, change collision mask include walls , set isinscene true don't have check again. this seems work well, every (and sadly quite often) exc_bad_access error out of nowhere. offending method seems contacttestbetweenbody, using determine when object touching either walls or solidifier @ times when normal collision detection turned off. necessary prevent objects bouncing off outside of wall object. here's small snippet of code illustrate. incidentally, 'objects' structure retains reference node along other useful details: if let solid