Posts

Showing posts from January, 2012

Facebook PHP SDK 5: Extending classes -

i'm newbie classes (worse namespaces, etc.) know must create facebookmyclass.php class main classes ( autoload.php , facebook.php , facebookapp.php , etc.), prototype: <?php // guess namespace facebook; // must 'use' or extending other class(es)? // use ; class facebookmyclass extends facebook { // have "re-declare" parent's vars? private $my_private_var; public $my_public_var; private $access_token; // main thing, think, how class constructed // public function __construct(array $config = []) { public function __construct($id, $secret) { // work? need parameters? parent::__construct(); } public function accessparentprotectedvars($idfanpage) { // how can call/link facebook object/request/response? $object = $this->get('/' . $idfanpage . '/albums?fields=name,id', $this->access_token); } private function gettokens($params = []) { // code... $this->access_token = '......

hibernate - Storing structured comments in MYSQL database using Java JPA and Spring Data -

using spring data , java jpa, store comment threads in mysql table. comments on chunk of data, , every comment can have number of child comments (think reddit). wondering if java class makes sense fulfill needs. @entity public class comment extends identified { // comment data @column(nullable=false) private string data; // parent comment @manytoone(fetch=fetchtype.lazy) @joincolumn(nullable=true) private comment parent; // sub comments @onetomany(fetch=fetchtype.eager) @joincolumn(nullable=true, mappedby="parent") private set<comment> children; public comment() { } .... to clarify, main concern regards having both manytoone , onetomany relationship same class. seems ugly, way express relationship. i assure mapping normal, usual. 2 relationships (many-to-one , one-to-many) realized in db using different concepts , not collide. relationship bidirectional, both mappings represent different ends of 2 ...

mysql - SQL update from one Databse to another based on a Title match -

i finished migrating wordpress database, went right. until realise got serious issue posts id changed after processes and i’m using posts id on urls , want keep using don’t lose old links. i still have both databases (old & new) , want know how can update id old 1 new 1 matching title? something like: update newbase table id oldbase table id oldbase title = newbase title :p :d thanks help. translating pseudo-code sql should trick: update newdb.tablename n inner join olddb.tablename o on n.title=o.title set n.id=o.id; caveat you might run duplicate id values, might want move them first select @oldmax:=max(id) olddb.tablename; select @newmax:=max(id) newdb.tablename; update newdb.tablename set id=id+@oldmax+@newmax;

c - Finding the intersection of a closed irregular triangulated 3D surface with a Cartesian rectangular 3D grid -

Image
i searching online efficient method can intersect cartesian rectangular 3d grid close irregular 3d surface triangulated. this surface represented set of vertices, v , , set of faces, f . cartesian rectangular grid stored as: x_0, x_1, ..., x_(ni-1) y_0, y_1, ..., y_(nj-1) z_0, z_1, ..., z_(nk-1) in figure below, single cell of cartesian grid shown. in addition, 2 triangles of surface schematically shown. intersection shown dotted red lines solid red circles intersection points particular cell. goal find points of intersection of surface edges of cells, can non-planar. i implement in either matlab, c, or c++. assuming have regular axis-aligned rectangular grid, each grid cell matching unit cube (and grid point ( i , j , k ) @ ( i , j , k ), i , j , k integers), suggest trying 3d variant of 2d triangle rasterization. the basic idea draw triangle perimeter, every intersection between triangle , each plane perpendicular axis , intersecting axis @ integer coordinat...

javascript - Gulp Watchify not printing build time for js files -

my gulp file seems running fine, , watchify working when make changes app.js file or sass files. happens when run gulp command: myname$ gulp [17:06:06] requiring external module babel-core/register [17:06:08] using gulpfile ~/some/path/gulpfile.babel.js [17:06:08] starting 'watch-styles'... [17:06:08] finished 'watch-styles' after 13 ms [17:06:08] starting 'scripts'... [17:06:08] finished 'scripts' after 42 ms [17:06:08] starting 'default'... [17:06:08] finished 'default' after 22 μs the thing is, these times show first time gulp . after i've run gulp command, build times don't show when make change js file. tell me build times sass files, not js. said before, watchify working , new output files created, there no feedback in terminal tells me how long took. in fact, there no message @ js changes. here gulpfile . i believe if change definitions of default , watch tasks expected result: gulp.task('watch-s...

c# - Microsoft ASP.NET and Web Tools 2015 - DNX and DNVM -

i have doubt regarding microsoft asp.net , web tools 2015 , installations of dnx , dnvm. point following: on official asp.net github there outlined procedure installing dnvm , dnx. install dnvm 1 runs following command on cmd: @powershell -noprofile -executionpolicy unrestricted -command "&{$branch='dev';$wc=new-object system.net.webclient;$wc.proxy=[system.net.webrequest]::defaultwebproxy;$wc.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials;invoke-expression ($wc.downloadstring('https://raw.githubusercontent.com/aspnet/home/dev/dnvminstall.ps1'))}" as said on page this download dnvm script , put in user profile. can check location of dnvm running following in cmd prompt: the dnvm installed on user profile on folder .dnx\bin . when using dnvm download dnx, gets installed on .dnx\runtimes dnu . i followed procedure , installed dnvm before installing visual studio 2015 , i've installed visual studio 2015 , micr...

jquery - Create a new Date() in JavaScript with my parameter -

i have following code: $(function () { var timestamp = 1443563590; //tue, 29 sep 2015 21:53:10 gmt var today2 = moment.unix(timestamp).tz('america/new_york').tostring(); alert(today2); //var dateinnewyork = new date(what should type here?); //alert(dateinnewyork.gethours()); }); and want create new date based on can see above. in future timestamp server, i'll keep current time in new york on client's side, whether has current time set in computer or not. how can create date then? http://jsfiddle.net/b8o5cvdz/5/ not sure understood completely, attempt answer understood: $(function () { var timestamp = 1443563590; //tue, 29 sep 2015 21:53:10 gmt var today2 = moment.unix(timestamp).tz('america/new_york').tostring(); alert(today2); var dateinnewyork = new date(today2); alert(dateinnewyork.gethours()); });

date - SQL Defining Weeks From Days -

i'm trying summarize data in table weeks on past 10 months. field in table lists days in format dd-mm-yy. there simple way group these data weeks? you try (tested sql server): just paste code empty query window , execute. adapt needs. declare @tbl table(datevalue varchar(8),othervalue int); insert @tbl values ('30-09-15',10) ,('29-09-15',20) ,('28-09-14',30) ,('28-08-14',10) ,('27-08-14',10); select convert(datetime,datevalue,3) converteddate ,datepart(wk,convert(datetime,datevalue,3)) weekindex ,othervalue @tbl --and way use aggregates ;with mydata ( select convert(datetime,datevalue,3) converteddate ,datepart(iso_week,convert(datetime,datevalue,3)) weekindex ,othervalue @tbl ) select weekindex,sum(othervalue) mydata group weekindex

html - Padding changes width inside table -

i have table has fixed width, , inside table need have inputs(text) has same width of table, don't want text of inputs @ left:0 , want them have padding left. when put padding inputs width changes more 100% . here html: <table cellspacing="25"> <tr> <td><input type="text" placeholder="lalala"></td> </tr> </table> and css. table { background-color: red; width: 300px; } table input { width: 100%; padding-left: 10px; } how can ensure width of input element 100% width of table cell? check fiddle add css rule input: box-sizing: border-box; the box-sizing property used tell browser sizing properties (width , height) should include. should include border-box? or content-box. here snippet: table { background-color: red; width: 300px; } table input { width: 100%; padding-left: 10px; box-sizing: border-box; } ...

dataframe - Data.frames in R: name autocompletion? -

sorry if trivial. seeing following behaviour in r: > mydf <- data.frame(score=5, scorescaled=1) > mydf$score ## forgot score variable capitalized [1] 1 expected result: returns null (even better: throws error). i have searched this, unable find discussion of behaviour. able provide references on this, rationale on why done , if there way prevent this? in general love version of r little stricter variables, seems never happen... the $ operator needs first unique part of data frame name index it. example: > d <- data.frame(score=1, scotch=2) > d$sco null > d$scor [1] 1 a way of avoiding behavior use [[]] operator, behave so: > d <- data.frame(score=1, scotch=2) > d[['scor']] null > d[['score']] [1] 1 i hope helpful. cheers!

angularjs - what do I use for model and controller with Facebook's React and ES6 -

i'm noob on react/es6 stack/framework. developing in backbone/marionette.js , started reading more es6 , react. considering background i'm used having backbone model , controller (mc of mvc pattern). have heard people using react backbone/ember/angular. experiences , different patterns trending in area @ moment. i'll appreciate sharing experiences/thoughts on this. in advance! facebook has proposed flux architecture way of flowing data unidirectionally react components. idea have separate container (often called "store") of data. register actions run through dispatcher , change data, causes view components update. there have been lot of implementations of idea. far there isn't single plug , play data model that's no-brainer use. one implementation has lot of people excited right called redux . react, draws inspiration functional programming school of thought. from readme: the whole state of app stored in object tree inside single st...

bash - How to customize PATH for sensu client? -

i have sensu client, debugged path in 1 of check script, , shows: /sbin:/usr/sbin:/bin:/usr/bin:/etc/sensu/plugins:/etc/sensu/handlers how can customize path sensu, say: want add /usr/local/bin end of path, results in: /sbin:/usr/sbin:/bin:/usr/bin:/etc/sensu/plugins:/etc/sensu/handlers:/usr/local/bin i've tried many ways didn't success, i've tried: set sensu user's shell /bin/bash (instead of default /bin/false), , add .bashrc|.profile under sensu user's home dir /opt/sensu, line: export path=$path:/usr/local/bin edit /etc/default/sensu, add line path=$path:/usr/local/bin by reading this: https://sensuapp.org/docs/latest/clients , set user=ec2-user in /etc/default/sensu, after restarting sensu client, see sensu client process running ec2-user, however, surprisingly, path not same ec2-user all 1,2 , 3 above didn't work, in check script written in python, have lins: from subprocess import call, popen, pipe import os import sys import shlex ...

C++ Header and Source file design implementation -

i have few queries regarding design principle of laying out c++ header , source files: have taken on project in previous programmer used have this, particularly annoying because read somewhere shouldn't include .cpp file in .hpp file (the preprocessor copies , pastes .cpp file .hpp) q1. including .cpp file in .hpp file bad? why? due problem above, facing many "multiple declaration" errors when load program in eclipse, though added header guards in .hpp files. q2. should including header guards in .cpp files well? tried later no avail. suggestions on this? q3. if 2 or more of .cpp files need same header files used best way include header files? should create new header file h1.hpp, include header files need in 2 or more .cpp files , later include in header file in .cpp files(s)? is efficient approach ? including .cpp file in .hpp file bad? why? in typical code setup, yes. serves no useful purpose , can lead "duplic...

c - When should I declare an array as static const? -

i came across warning in linux system array declared in usual manner. warning said static const char * const should used instead of char * . why that? how know when should array declared static constant? what const after char * mean?

visual studio 2012 - SSIS 64 bit vs 32 bit -

Image
i developing ssis package in vs 2012 being deployed sql server 2012. package pulling data external database 32 bit driver , loading sql server 2012. have package set using project parameters store connection strings. i can run package vs , can run package via 32 bit dtexec. cannot run package sql agent. have job set using ssis proxy account. i have tried run package execute process task runs package in 32 bit dtexec. i following error in cases. seems either 32/64 bit issue or permissions issue although cannot figure out is. appreciated! data flow task:error: acquireconnection method call connection manager mydatabaseconmgr failed error code 0xc0014009. there may error messages posted before more information on why acquireconnection method call failed. unlike ssdt, sql server agent runs on 64 bit mode. can configure sql job run on 32 bit mode traversing steps > edit > configuration > advance

javascript - Node.js app suddenly fails on local Docker -

i have simple node.js app cloned this , addition it's connecting rds instance. runs fine locally (osx boot2docker ), , runs few minutes when place in docker container, , of sudden, page no longer renders , empty response server. container still running yet i'm getting strange message in logs. various files below. what missing here? docker run command docker run -p 49161:3000 -d <image name> dockerfile from centos:centos6 # enable epel node.js run rpm -uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # install node.js , npm # run yum -y install node run yum install -y npm run npm install -g express-generator@4 run npm install supervisor -g run npm install pg --save run npm install winston --save # bundle app source copy . / # install app dependencies run npm install expose 3000 cmd ["npm", "start"] docker logs crashing child error reading path: /proc/1/task/1/cwd/proc/1/map_files error re...

zend framework2 - How to check for oAuth2 scopes in Apigility? -

i creating apigility project hosting of our apis. need able use oauth2 authentication cannot figure out how control access apis, seems once client authenticates, can use of our apis want limit them use specific ones define. after reading oauth2 library apigility uses, saw there scopes can defined have not found documentation how check user's scope see if have access. want find out if best way restrict access apis , how set if is, or there better way control access? just implemented functionality using following recipe ... https://github.com/remiq/apigility-zfc-rbac-recipe it worked , took few hours working. alternatively can checking in controller action (resource method) $identity = $this->getidentity()->getauthenticationidentity(); $scope = $identity["scope"] if (! in_array('admin', $scope)) { return new apiproblem(response::status_code_401, 'no auth'); } the above code untested should on right path if wanted way ...

ubuntu - Writing code in terminal mode? -

i have write shell code in terminal mode on ubuntu. have code , it's supposed to, don't know how write in terminal mode. not allowed use text editors. below code suppose do. echo "part 2 of program" while true read firstnumber read secondnumber if [ $firstnumber -eq 99 ] || [ $secondnumber -eq 99 ]; echo "you have exited part 2 of program" break; elif [ $secondnumber -eq 0 ]; echo "the number must not 0" else math=$((firstnumber / secondnumber)) echo "$firstnumber divided $secondnumber = $math" fi done now have create file , write code in terminal mode. again, cannot use text editor. know how create file in terminal mode. however, not know how supposed write code on terminal mode without using text editor. supposed append code onto file. help. this seems artificial restriction, however, such tasks can use. cat > filename.txt type or paste ( ctrl-shift-v ) in, press ctrl-d when you're fin...

ios - Is there any way to code the LaunchScreen programmatically -

i using xcode7 , swift storyboards. when open launchscreen.storyboard, , try set custom class on it, xcode complains 1 cannot have custom class on launchscreen storyboard. question is, there way programmatically code launchscreen avoid having drag , drop elements on using ib. no, launch screen shown before app starts executing in order provide transition springboard app while loading. you can either use fixed image or can use simple storyboard scene using standard, static ui elements - labels & images. this storyboard scene loaded , displayed os, security risk allow code execute in context.

java - How to monitor if my App is paused or resumed? -

i have android app want track when app paused or resumed. paused: user pressed home button , app still running in background. resumed: app runs in background , user opens app. how can being notified when app paused/resumed? paused: user pressed home button , app still running in background. i going guess initial state 1 of activities in foreground @ time home button pressed. on whole, there no notion in android of "app" being in foreground or background, though use phrasing shorthand other scenarios. whatever activity in foreground called onpause() , onstop() when user presses home, events called in many other scenarios (e.g., user presses back). onuserleavehint() called when user presses home not back, onuserleavehint() not called in other scenarios (e.g., incoming call screen takes on foreground). whether onuserleavehint() meet requirements, cannot say. resumed: app runs in background , user opens app. onstart() , onresume() , @ mi...

ios - i want to swipe right and left in swift -

i have project in xcode 7 ( swift ) want load differents viewscontrollers designeds in storyboard function swipe right , left , go next viewcontroller or back. have fade in right left , want 2 fade ins. func respondtoswipegesture(sender: uiswipegesturerecognizer) { switch sender.direction { case uiswipegesturerecognizerdirection.right: print("swiped derecha") self.performseguewithidentifier("cambio2", sender: nil) case uiswipegesturerecognizerdirection.left: print("swiped izquierda") self.performseguewithidentifier("cambio", sender: nil) default: break } } you can use uiswipegesturerecognizer creating 2 instance of it. 1 each direction. var swipeleft : uiswipegesturerecognizer = uiswipegesturerecognizer(target: self, action: "swipe:") swipeleft.direction = uiswipegesturerecognizerdirection.left var swiperight : uiswipegesturerecognizer = uiswipeges...

arrays - 2D interpolation in C -

so program supposed ask user temperature in kelvin s , starting ne . , interpolate find given value. the temp array temperatures , used find temperature between. the n array ne 's , used find ne between. whatever spots in each end being spot interpolating in bigger array, hpe. the main function ask user temperature , ne , calls upon interpolation function. the interpol function function interpolates. first finds given temperature in temp array. finds given ne in n array. uses spot (hpe[k][l]) 2d interpolation. my problem when run , enter values should giving me answer, "the value determined nan " what doing wrong? #include <stdio.h> #include <stdlib.h> #include <math.h> double interpol(double ti, double ne); int main() { int ni; double ti, result, ne; printf("\nenter temperature in kelvins , ne separated space.\n"); ni = scanf("%lf %lf", &ti, &ne); result = interpol(ti, ne); pr...

javascript - How to stop animation on background image -

i have animation on background image in website, image moving on left time when image come end start again. problem when image come end (left side) edges visible , want when come left side go right, when come right side..on left again. var x=0; var y=0; var banner = $("#loading"); banner.css('backgroundposition', x + 'px' + ' ' + y + 'px'); window.setinterval(function(){ banner.css('backgroundposition', x + 'px' + ' ' + y + 'px'); x--; }, 90); here's example animation: var x = 0; var fps = 30; var speed = 2; var bannerwidth = 400; var imagesize = 128; setinterval(function() { x += speed; if (x >= bannerwidth-imagesize || x <= 0) { speed *= -1; } $("#banner").css("backgroundposition", x + "px 0"); }, 1000/fps); #banner { width: 400px; height: 128px; border: 1px solid red; backgroun...

Conditional table sum on r -

this question has answer here: how sum variable group? 9 answers what i'm trying sum table variable if 1 true, example: this part of table: school sex age studytime 1 2 m 18 2,1 1 1 m 19 2,8 1 2 f 18 2,6 1 3 m 17 2,7 1 3 f 17 1,1 1 4 f 19 3,8 1 1 m 20 2,5 and need sum studytime each sex, this: sex studytime m 10,1 f 7,5 a base r method based on aggregate below: aggregate(x$studytime,by=list(sex=x$sex),sum)

Not able to add Audit policy (ACE) for object access (Folder) in windows using c++ -

i writing c++ program add ace object access audit sasl. though functions return success, when go , check properties of folder manually, not see policy has been set. below code. have modified sample code given in msdn site @ below link add sasl instead of dacl . https://msdn.microsoft.com/en-us/library/windows/desktop/aa379283(v=vs.85).aspx bool setprivilege( handle htoken, // access token handle lpctstr lpszprivilege, // name of privilege enable/disable bool benableprivilege // enable or disable privilege ) { token_privileges tp; luid luid; if (!lookupprivilegevalue( null, // lookup privilege on local system lpszprivilege, // privilege lookup &luid)) // receives luid of privilege { printf("lookupprivilegevalue error: %u\n", getlasterror()); return false; } tp.privilegecount = 1; tp.privileges[0].luid = luid; if (benableprivilege) tp.privileges[0].attributes = se_privilege_enabled; else tp...

java - Having trouble with writing a .txt flie -

so having trouble getting program not throw nosuchelement exceptions @ me. when input owner info, throws exception after second owner no matter owner input: jones; 221 smith st; arlington; texas; 76019 smith; 7345 lane rd; dallas; texas; 75000 willis; 596 dale lane; fort worth; texas; 76123 here's code: import java.util.formatter; import java.util.scanner; import java.util.nosuchelementexception; import java.util.stringtokenizer; public class writefile { public static void main(string[] args) { formatter output; try { output = new formatter("owners.txt"); system.out.println("file accessed"); system.out.println("please enter owner information. separate information semicolons please:"); scanner input = new scanner(system.in); while(input.hasnext()) { try { string owner = input.nextline(); string[] tokens = owner.split(...

javascript - How to copy file and folder in NexentaStor -

on nexenta, if create folder via apis can displayed on web admin. , need create folder/file automatically, cannot find api support this. here apis of nexenta. using javascript call nexenta's apis, how can create folder/file or copy local ( or location) ?

javascript - Application of styling widgets in jQuery seems to differ -

in code snippet demonstrate how i'm applying different classes 2 different accordion widgets using #divid .class . works great, when try apply style dialog widget, doesn't perform same. can't figure out. why same rules not apply? i'm new jquery. $(function() { $("#dialog").dialog(); }); $(function() { $("#dialog2").dialog(); }); $(function() { $("#accordion").accordion(); }); $(function() { $("#accordion2").accordion(); }); #dialog .ui-dialog-titlebar { background-image: none; background-color: red; } #dialog2 .ui-dialog-titlebar { background-image: none; background-color: green; } #accordion .ui-accordion-header { background-image: none; background-color: red; } #accordion2 .ui-accordion-header { background-image: none; background-color: green; } <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <link rel="styl...

Conditionally concat a dataframe in python using pandas -

i have data frame df b 0 test1 1 1 test2 4 2 test3 1 3 test4 2 df1 c 0 test3 1 test5 i want conditionally merge them new dataframe df2 b 0 test1 1 1 test2 4 2 test3 0 3 test4 2 4 test5 0 a new data frame if value in column equal column c, while merging update column b value default of 0 , if there there isn't value exists in column equal value in column c add data frame shown above default value of 0. here simple approach. take element second dataframe in col c not in col a on first dataframe - , concatenate setting missing values 0 . use small hack in groupby in case there several same values in col a , select 1 0 : pd.concat([df,df1.rename(columns={'c':'a'})]).fillna(0).groupby('a', as_index=false).last() b 0 test1 1 1 test2 4 2 test3 0 3 test4 2 4 test5 0

python - How to create login client's account with Twitter? -

i've created web application, want put login authentication using twitter account. as stackoverflow include gmail , facebook login stackoverflow. want make same thing application. i'm bit confused here, here example found. please see this . i found url bar generates this: https://twitter.com/oauth/authenticate?oauth_token=vou5saaaaaaaaso2aaabubx3tge but i'm finding difficulties generate own's application oauth_token . can please me? how generate it? googled , searched twitter everywhere. none of things worked me. :( please me.. help appreciated!!

Android:SocketTimeoutException: failed to connect to /103.24.4.60 (port 80) after 30000ms -

i want download image http url , save sd card after load , show image view. have tried image-loader tutorial android-hive used http url load image after run image can't load , show. app not crash getting error exception java.net.sockettimeoutexception: failed connect /103.24.4.60 (port 80) after 30000ms in imageloader class here log information 09-30 02:32:15.820 18371-18389/? w/system.err﹕ java.net.sockettimeoutexception: failed connect /103.24.4.60 (port 80) after 30000ms 09-30 02:32:15.820 18371-18389/? w/system.err﹕ @ libcore.io.iobridge.connecterrno(iobridge.java:169) 09-30 02:32:15.820 18371-18389/? w/system.err﹕ @ libcore.io.iobridge.connect(iobridge.java:122) 09-30 02:32:15.820 18371-18389/? w/system.err﹕ @ java.net.plainsocketimpl.connect(plainsocketimpl.java:183) 09-30 02:32:15.820 18371-18389/? w/system.err﹕ @ java.net.plainsocketimpl.connect(plainsocketimpl.java:456) 09-30 02:32:15.820 18371-18389/? w/system.err﹕ @ java.net.socket.connect(socket.java:882...

javascript - Create Node.js Website on remote server -

i'm new node.js , i've been going through tutorials. i've been able make simple web page in node.js , run own server command line on desk top. however, create use website others can access, well. therefore wondering how can host web site built node.js on remote server? option 1: if have public ip can host website on server option 2: find service provider can host node.js application. e.g heroku

How to make a WPF application be on topmost of all other WPF application?(using VB.NET) -

i new in wpf. have 2 wpf applications , both have topmost property true. 1 application contain multiple window , second application have 1 window(work button) both application work independently. problem when tried run 1st application hide running button(i.e 2nd application) want show both application simultaneously.i don't know i don't know how make question duplicate but should able find answer here wpf on top

javascript - angularJS $timeout executing method instantly -

i using ionic framework , cordova-plugin-shake plugin detect device shaking 1 of android application, working fine. problem after shake disable shaking detection 30 second, trying use $timeout this: $timeout($scope.watchforshake(), 30000); but somehow $timeout , no matter delay value is, $scope.watchforshake() executed instantly. i have tried using settimeout result still same. $timeout (and settimeout ) expect callback function first parameter - function execute after time-out. if want function .watchfortimeout execute, pass function first parameter: var callbackfn = $scope.watchfortimeout; $timeout(callbackfn, 30000); after 30 seconds, function callbackfn invoked no parameters: callbackfn() . in case, invoking $scope.watchfortimeout right away, passing return value of function first parameter `$timeout. so, doing (incorrectly) is: var returnval = $scope.watchfortimeout(); $timeout(returnval, 300000)

jQuery Validation script doesn't work, at all -

so i'm creating contact form, , i'm trying create validation script, , doesn't work @ all, doesn't show errors. goes default validation. i have looked in resources, , js file loaded on page doesn't work...? jquery.validator.addmethod("answercheck", function(e, t) { return this.optional(t) || /^\bcat\b$/.test(e) }, "please type correct answer"), $(function() { $("#contact").validate({ rules: { name: { required: !0, minlength: 2 }, email: { required: !0, email: !0 }, message: { required: !0 }, answer: { required: !0, answercheck: !0 } }, messages: { name: { required: "please enter name", minlength: "your name must consist of @ least 2 ch...

ios - set ATS keys in watchkit extension & watch app .plist file -

i submitting build in app store using xcode 7..my app supports watch app , not able figure out need set ats(app transport security) exemption keys in watchkit extension & watch app .plist files ( setting ats exemption keys in main app .plist file)..thanks in advance ats keys need set in iphone app .plist file & watchkit extension .plist file (for watchos2 support)...

java - Android embedded barcode scanner -

i'm trying build android app, point of sale machine. on opening app, 1 corner of app should have camera view, listening barcode (battery drain part understandable , that's acceptable in case). remaining part of app should show items added cart. the use case here keep listening barcode in 1 part of ui , remainng part of app shows scanned content. there should not switch between apps main screen , barcode scanner. can please on this?

android - RecyclerView.OnClickListener vs View.OnClickListener -

i can implement both of them in recyclerview holder public class pagospendientesviewholder extends recyclerview.viewholder implements recyclerview.onclicklistener public class pagospendientesviewholder extends recyclerview.viewholder implements view.onclicklistener what difference? there no difference between two. same interface. recyclerview extends viewgroup extends view . implementing same interface. use second.

Corrupt when using Google Play Services Face Detection in Picasso Transformation. (Fatal Signal) -

i'm writing face crop transformation of picasso. make face in image shown when picasso cropping image. implement picasso transformation , using face detection in function public bitmap transform(bitmap source) . import com.squareup.picasso.transformation; .... public class facecrop implements transformation { ... @override public bitmap transform(bitmap source) { facedetector mfacedetector = new facedetector.builder(mcontext).settrackingenabled(false).build(); if (!mfacedetector.isoperational()) { return source; } frame frame = new frame.builder().setbitmap(source).build(); sparsearray<face> faces = mfacedetector.detect(frame); // crash here ... rectf rect = null; (int = 0; < faces.size(); i++) { face face = faces.valueat(i); float x = face.getposition().x; float y = face.getposition().y; rectf facerect = new rectf(x, y, x + face.getwi...

Live Video Chat app in iOS for iPhone and iPad -

i wanted develop app live video chat skype or tango. have search lot on internet not found helpful answer. want 2 peoples communicate each other through live video chat. if have helpful answer please post below can move forword in project. in advance. i think have follow given link sample demo video chat i hope great. if queries sample demo comment here.

c - Linux serial port programming c_cc character configurations -

by referencing source in following link : serial_port_programming_how_to i found out there c_cc character configurations there. after searching around affections, did not find exact answer this. try comment out each line of these c_cc configurations , found out following line affect output. newtio.c_cc[veof] = 4; can explain meaning of , possibly rest of these? thanks as suggested, manual page termios starting point: veof (004, eot, ctrl-d) end-of-file character (eof). more precisely: character causes pending tty buffer sent waiting user program without waiting end-of-line. if first character of line, read(2) in user program returns 0, signifies end-of-file. recognized when icanon set, , not passed input. in context of given link, 3.1. canonical input processing , op has observed commenting out assignment newtio.c_cc[veof] = 4; prevents ^d working expected. that, , similar assignments correspond settings 1 might use shell scri...

variables - PHP 5.5: accessing a static class member of a dynamic class stored in an object -

we assume following: class { public static $foo = 'bar'; } class b { public $classname = 'a'; } $b = new b(); is somehow (curly braces etc.) possible access $foo directly without generating "unexpected :: (t_paamayim_nekudotayim)": $b->classname::$foo //should result in "bar" not in "unexpected :: (t_paamayim_nekudotayim)" i know , use following workaround: $c = $b->classname; $c::$foo; but know if exists nice way access $foo directly. you can using variables variable as class { public static $foo = 'bar'; public function getstatic(){ return self::$foo; } } class b { public $classname = 'a'; } $b = new b(); $a = new a(); echo ${$b->classname}->getstatic();//bar

android - how to store data from sqlite to google excel sheet -

i new in android. made 3 columns in sqlite , storing user input in sqlite i want when device wifi(internet) upload data google excel sheet accordingly column on specific user account. my solution convert sqlite database csv in first step in second step convert csv file xls , works fine me, need 2 libraries (opencsv-1.7.jar; poi-3.8-20120326.jar) public class exportdatabasecsvtask extends asynctask<string, void, boolean> { private final progressdialog dialog = new progressdialog(databaseexampleactivity.this); @override protected void onpreexecute() { this.dialog.setmessage("exporting database..."); this.dialog.show(); } protected boolean doinbackground(final string... args) { file dbfile=getdatabasepath("database_name"); //aabdatabasemanager dbhelper = new aabdatabasemanager(getapplicationcontext()); aabdatabasemanager dbhelper = new aabdatabasemanager(databaseexampleactivity.this) ; system.out.println(...