Posts

Showing posts from May, 2013

javascript - How to add a nice legend to a d3 pie chart -

Image
i have pie chart working ok add nice legend kind of (made in mspaint) but can't quite make work... here pie chart code (without legend part) : <!doctype html> <html> <head> <script data-require="d3@3.5.3" data-semver="3.5.3" src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.js"></script> </head> <body> <script> var newdata = [{ count: 1, emote: "onetwothree" }, { count: 1, emote: "fourfivesix" }, { count: 1, emote: "seveneightnine" }, { count: 15, emote: "teneleventwelve" }, ] // define size & radius of donut pie chart var width = 450, height = 800, radius = math.min(width, height) / 2; // define arc colours var colour = d3.scale.category20(); // define arc ranges var arcte

haskell - Extending algebraic data type -

note: if question somehow odd, because exposed haskell , still adapting functional mindset. considering data type maybe : data myownmaybe = myownnothing | myownjust everyone using data type write functions like maybetolist :: myownmaybe -> [a] maybetolist myownnothing = [] maybetolist (myownjust x) = [x] now, suppose that, @ later time, wish extend data type data myownmaybe = myownnothing | myownjust | superpositionofnothingandjust how make sure everyone's functions break @ compile-time? of course, there chance somehow i'm not "getting" algebraic data types , maybe shouldn't doing @ all, considering data type action data action = reset | send | remove it seem adding action add not uncommon (and wouldn't want risk having these functions around possibly cannot handle new action ) well, bad news first: can't it. period. but language-agnostic; in language have break interface. there no way around it. now, news: can go

json - .htaccess folder to index.php and file to file -

i'm creating api specific part of webapplication. api located in subfolder api. see folder structure below: - api - cars - index.php - count.php however, tricky part. customers requesting endpoints end json: cars.json => cars/index.php cars/count.json => cars/count.php i'm not expert in rewrites. possible? try in htaccess : rewriteengine on rewriterule ^cars\.json$ /cars/index.php [nc,l] rewriterule ^cars/count\.json$ /cars/count.php [nc,l] the first rule rewrites cars.json cars/index.php , second rule rewrites cars/count.json cars/count.php .

c# - ParsePush throws Exception 400 in Unity -

i have written function send push notification request server. using unity parse. when send request parse.parseexception: 400: bad request. the idea send notification 1 player letting them know have been attacked player. can see i've done wrong? debug.log ("<color=#ffa500ff> sending push notification </color>"); string pushmsg = "you attacked " + serverdata.instance.my_player.username; if(!serverdata.instance.pvp.pvpopponentdata.attackerwon) pushmsg += " , lost fight."; else pushmsg += " , won fight!"; debug.log(pushmsg); parsepush push = new parsepush(); push.query = parseinstallation.query.whereequalto("player",parseobject.createwithoutdata("player",serverdata.instance.pvp.pvpopponentdata.targetobjectid)); push.data = new dictionary<string, object> { {"title", serverdata.instance.pvp.pvpopponentdata.bragmessage}, {"aler

android - how to add function on child items in expandablelistview? -

good day! new in android programming , java, did copy paste of source code in internet worked have edit this. i wanna ask how add function when click on switch of every group supposed on/off not toast. understand how use onclicklistener somehow dont know put function. any answers or tutorial link appreciated thank you! mainactivity.java package com.capstone.r.e.d.e_kit; import java.util.arraylist; import android.app.expandablelistactivity; import android.content.context; import android.os.bundle; import android.view.layoutinflater; import android.widget.expandablelistview; public class mainactivity extends expandablelistactivity{ private arraylist<string> parentitems = new arraylist<string>(); private arraylist<object> childitems = new arraylist<object>(); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // not necessary expandablelistactivity contains expandablelist //setcontentview(r

redhat - rsync: @ERROR: auth failed on module tomcat_backup -

i can't figure out what's going on rsync. i'm running rsync on rhel5, ip = xx.xx.xx.97. it's getting files rhel5, ip = xx.xx.xx.96. here's log (which specified on rsync command line) shows on xx.97 (the 1 requesting files): (local time) 2015/08/30 13:40:01 [17353] @error: auth failed on module tomcat_backup 2015/08/30 13:40:01 [17353] rsync error: error starting client-server protocol (code 5) @ main.c(1530) [receiver=3.0.6] here's log(which specified in rsyncd.conf file) shows on xx.96 (the 1 supplying files): (utc time) 2015/08/30 07:40:01 [8836] name lookup failed xx.xx.xx.97: name or service not known 2015/08/30 07:40:01 [8836] connect unknown (xx.xx.xx.97) 2015/08/30 07:40:01 [8836] auth failed on module tomcat_backup unknown (xx.xx.xx.97): password mismatch here's actual rsync.sh command called xx.xx.xx.97 (the requester): export rsync_password=rsyncclient rsync -havz --log-file=/usr/local/bin/rsync/test.log rsync://rsyncclient@xx.xx.

angularjs - Form validation with modals in Angular -

i have form inside modal pop up. trying run form validation on inputs after user attempts submit form. far, i'm struggling make things work. in view, have following (sorry if there syntax errors, i'm converting jade on fly): <script type="text/ng-template", id="modalvideonew"> <div class="ngdialog-message"> <form class="form-horizontal" ng-submit="submitform()" novalidate name="newvideoform"> ... <div class="form-group"> <label> title </label> <div class="col-sm-8"> <input type="text" name="title", required='', ng-model="newvideoform.title"> <span class="text-danger" ng-show="validateinput('newvideoform.title', 'required')"> field required</span> </div> </div> </div> </script> and in

php - Best way to detect the language of User? -

this question has answer here: detect browser language in php 10 answers what best way detect language of user? have in application dropdownlist user can select application language (english or portuguese), internationalization works well, after logging in. i login screen, system presented in correct user language (for example based on browser language). is correct so? how done? edit i got following article: https://github.com/samdark/yii2-cookbook/blob/master/book/i18n-selecting-application-language.md is correct so? can check use ip , check country come. worst case when not able switch language.

node.js - Handle disconnect / logout events -

after connecting client subscribes specific room contains connected users: io.socket.get('/connection/subscribe', function(data, jwr) { io.socket.on('user_connected', function(user) { console.log('new bro connected'); }); }); at moment i'm storing user ids in memory. therefor use single variable, var connectionids = []; /*...*/ subscribe: function(req, res) { if(typeof req.user !== 'undefined') { sails.sockets.join(req.socket, 'users_online'); user.find(req.user.id).exec(function(err, user) { if(connectionids.indexof(user[0].id) == -1) { connectionids.push(user[0].id); } sails.sockets.broadcast('users_online', 'user_connected', user); }); return res.ok(); } }, everything works fine far, problem handling disconnect or logout events. after closing window, logging out or similar need unsubsribe users_online room. alread

How to upload a large file on android? -

recently have been working on app , requires files on phone uploaded server. these file may either images or videos. used asynctask networking on background. however if file size greater 45 mbs file upload fails...it works fine other-wise what should use instead of async tasks? should go sync adapters or volley library? know nothing in either of these. you can use retrofit typedfile approach upload file in multi-part. for reference : https://futurestud.io/blog/retrofit-how-to-upload-files/

node.js - mysql query in nodejs not returning the result as expected -

i have 3 tables, namely en_providers contain providerid, provideridsports , more fields, second table _lookup_sports contain sportid , sporttitle fields, table en_venue contain fields providerid,venuename,venudescription , more. relation between tables sportid _lookup_sports stored in serialized array format in provideridsports field in en_providers table. user enter sporttitle sportid selected usig following query. con.query("select sportid _lookup_sports sporttitle=?",[req.body.sportname],function(err,data){ //something }); this query working fine , getting matched sportid. unserialize sportids stored in provideridsports, using phpunserialize module. below query working, con.query("select providerid,provideridsports en_providers", function(err, data) { if (err) { console.log("length:" + err); } if (data.length) { ( var = 0; < data.length; i++) { console.log(phpunserialize(

android - How to Use Collapsing ToolBar with a ListView instead of a Recycler View -

does know how implement collapsing toolbar using listview instead of recycler view? to make woks should to: implement nestedscrollingchild in custom listview implementation. add field private final nestedscrollingchildhelper mscrollingchildhelper; , init in constructors delegate methods nestedscrollingchild invoke setnestedscrollingenabled(true); after mscrollingchildhelper initialization here list view implementation example: public class nestedscrollinglistview extends listview implements nestedscrollingchild { private final nestedscrollingchildhelper mscrollingchildhelper; public nestedscrollinglistview(context context) { super(context); mscrollingchildhelper = new nestedscrollingchildhelper(this); setnestedscrollingenabled(true); } public nestedscrollinglistview(context context, attributeset attrs) { super(context, attrs); mscrollingchildhelper = new nestedscrollingchildhelper(this); setnesteds

ggplot2 - ggplot in R with fortify takes too long to process small geospatial data -

Image
i trying use ggplot draw map of canada , colour code each region based on total sales. geospatial file gadm , contains 12 provinces (level 1). when fortify data resulting data.frame on 4 million rows. when when try draw map ggplot seems hang. i've left 30 minutes , had give up. is problem size of result of fortify? don't know how reduce size. i've tried playing 'region' argument in fortify causes fortify appear hang. i have included code , url download data working with. require(dplyr) # loaded from: https://raw.githubusercontent.com/technology-hatchery/rcode/master/data/sample%20-%20superstore%20sales%20(excel).csv orders <- read.csv(file='data/orders.csv', sep=',', header=true, na.strings = '') orders$order.date <- as.date(orders$order.date, '%m/%d/%y') orders$order.priority <- as.factor(orders$order.priority) orders$customer.name <- as.character(orders$customer.name) orders$ship.date <- as.date(orders$ship

java - Ehcache of spring doesn't work correctly between microservices -

i have monolithic application.according microservices appearance , needs adapt appearance splited small apps.you assume after splinting each microservice has model has 1 object same in microservices.the following example clearing. into micro1: class { private object obj; //getter , setter } into micro2: class b { private object obj; //getter , setter } and object obj has own repository , service , controller layer. there config of ehcash of spring @ save method service layer of model. this: @transactional @override @caching(evict = { @cacheevict(value = "obj", key = "#obj.id" ) }) public integer save(object obj) { //code here } it working when application monolithic after spliting because of obj dependency microservices , method(save method) repeated each microservice,the ehcash doesn't work correctly. how do when each microservice affects object obj other microservices aware to. there many solution can in problem , redis hav

recursion - How to calculate the number of recursive calls made to the Ackerman() function in C -

i tried writing code calculate ackerman value , number of times function called. however, counter stuck @ 0 time. me out? /* a(m,n) = n+1, if m==0 a(m,n) = a(m-1,1), if m>0 , n==0 a(m,n) = a(m-1,a(m,n-1)), if m>0 , n>0 */ #include<stdio.h> static int w=0; int ackerman(int m,int n) { w=w+1; if(m==0) return n+1; else if(m>0 && n==0) return ackerman(m-1,1); else if(m>0 && n>0) return ackerman(m-1,ackerman(m,n-1)); } int mainackerman() { int m,n; scanf("%d %d",&m,&n); printf("%d %d",ackerman(m,n),w); return 0; } you have sequence-point issue. on same line calling ackerman , using value affected call. undefined behaviour. instead: int result = ackerman(m,n); printf("%d %d", result, w); there good question on stackoverflow excellent answers related sequence-points. it's related c++, idea same c.

c# - How do I select entries through an intermediary table relationship? -

this has obvious answer, drawing blank somehow. have 3 tables, let's called: people addresses addressdetails i using entity framework (so above models relationships set up). trying select data typical ef linq query (doesn't matter whether method or query syntax). people , addresses many-to-many. addresses , addressdetails one-to-one(/zero). need select entries addressdetails correspond particular personid. know connection there since can select addresses personid = n, , each address has 1 addressdetails entry, how do properly? i tried following: var details = p in db.people p.id = n in p.addresses ad in a.details select ad; visual studio highlights "details" in a.details , gives following: 'api.models.addresses' not contain definition 'api.models.details"... i ef telling me doesn't see relationship. did verify one-to-one the

android - how to show contact list names in an AutoCompleteTextView -

i trying use names phones contact list autocompletetextview when user starts typing name show suggestions auto complete contacts. plus it's done within custom dialog. but doesn't work. here relevant code: autocompletetextview friendname; case r.id.add_debt_menu: // custom dialog final dialog dialog = new dialog(this); dialog.setcontentview(r.layout.add_debt_dialog); dialog.settitle("add debt"); friendname = (autocompletetextview)dialog.findviewbyid(r.id.name); cursor cursor = getcontentresolver().query(contactscontract.contacts.content_uri,null,null,null,null); while (cursor.movetonext()){ name = cursor.getstring(cursor.getcolumnindex(contactscontract.contacts.display_name)); arraylist<string> contacts = new arraylist<>(); contacts.add(name); } cursor.close(); arrayadapter<string> adapter = new arrayadapter(thi

c# - For Each SQL Insert change the box ID +1 -

in situation generating dynamic text box based on list box click capture data point, once done need each select , insert them individually database. issue follows. we have for each item in listbox --call sql connection-- @var = textbox1.text.tostring() upon next run (next each item) need code increase textbox1 textbox2 . any general thoughts on how accomplish this? something int iterator = 1; foreach (listboxitem item in yourlistbox.items) { textbox tbx = new textbox(); tbx.id = "textbox" + iterator.tostring(); //your sql operation iterator++; }

lazy evaluation - Scala: partially evaluate a function and cache fixed values -

is there easy way cache fixed values of partially applied function, in pure functional way. code sample: scala> def f(x:int,y:int)={ def expensivecalculation(num:int)={ println("i've spent lot of time(!) calculating square of "+num) num*num } lazy val x2=expensivecalculation(x) lazy val y2=expensivecalculation(y) lazy val r=x2+y2 r } scala> def g=f(1,_:int) scala> g(2) i've spent lot of time(!) calculating square of 1 i've spent lot of time(!) calculating square of 2 res18: int = 5 scala> g(3) i've spent lot of time(!) calculating square of 1 i've spent lot of time(!) calculating square of 3 res19: int = 10 but don't want expensivecalculation called 2 times num=1 . since expensivecalculation side effect free, there no problem in saving results (please don't consider side effect of printing on output stream in sample code). i can implement i'm looking using oop style saving state

How to delete duplicate row in mysql table based on the value of a third column in php -

i new php. asking delete row according value of third column. table consist of id , datetime fields. here code tried stuck next: $cxn = mysqli_connect($host,$user,$pass,$dbname) or die("couldn't connect server"); $qry = "select id, date(validdatetime) date, time(validdatetime) time tempstore order id"; $result = mysqli_query($cxn,$qry) or die("couldn't execute query"); while ($row=mysqli_fetch_assoc($result)) { extract($row); $hours = date("h",strtotime($time)); if ($id[$i] == $id[$i+1]) { echo "<p>$id $date $hours</p>\n"; } $i++; //print_r($hours); } i extract date , time datetime fields in table extract again hours time distinguish if user have inputs in same hour in same date , delete leaving his/her first inputs in different hours. hope can understand trying achieve , me solve problem. thank in advance.

php - SQL query on how to Count the number of comments each post have -

i have 2 database table called "comments" , "posts" in "posts" table got post_id, post_title in "comments" table got comment_id, post_id, message the post_id in comments table stores id of post being commented. way can count how many comments post have. i tried doing research , end code below: $displaypost = "select * posts"; $result = $conn->query($displaypost); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $postid = $row['post_id']; $posttitle =$row['post_title']; $countdata = "select count(post_id) comments post_id='$postid'"; $countresult = $conn->query($countdata); $countrow = mysqli_fetch_row($countresult); $total_comment = $countrow[0]; echo "post title: $posttitle"; echo "post comment: $total_comment"; } } else { echo "0 results"; } th

swift - In app purchase in SKScene not working? -

i'm creating spritekit game in swift , i'm trying implement in app purchases. i followed question here: in app purchase in skscene and here code: in didmovetoview: // set iaps if(skpaymentqueue.canmakepayments()) { println("iap enabled, loading") var productid:nsset = nsset(objects: "gameoversavesavior") var request: skproductsrequest = skproductsrequest(productidentifiers: productid set<nsobject>) request.delegate = self request.start() } else { println("please enable iaps") } outside of didmovetoview in gamescene : //in app purchase ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ var productlist = [skproduct]() var p = skproduct() func purchasemade() { println("they bought it!") } func buyproduct() { println("buy" + p.productidentifier)

php - Can't connect to database when code is moved to a function -

this question has answer here: php function use variable outside 3 answers i want make function counts total of user in database. $count = "select count(userid) user "; $run=mysqli_query($con,$count); $result = mysqli_fetch_array($run); echo $result[0]; the code above works fine. however, when put inside function: <?php include("db.php"); function popo() { $count = "select count(userid) user "; $run=mysqli_query($con,$count); $result = mysqli_fetch_array($run); echo $result[0]; } ?> <?php popo(); ?> the following errors appear: warning: mysqli_query() expects parameter 1 mysqli, null given in c:\xampp\htdocs\admin\includes\function.php on line 5 warning: mysqli_fetch_array() expects parameter 1 mysqli_result, null given in c:\xampp\htdocs\admin\includes\function.php on line 6 $co

Compiling issues : Apache headers not found - CentOS 6.x -

i trying build libwurfl ( https://github.com/filosganga/libwurfl ) on centos. have installed dependent libraries, having issues running configure libwurfl. getting issues apache headers not found issue. if use --with-apxs shown below, ./configure --with-apxs=/usr/sbin/apxs/ output: checking apr.h... yes checking httpd.h usability... no checking httpd.h presence... no checking httpd.h... no configure: error: apache headers not found. if add --with-apache ./configure --with-apxs=/usr/sbin/apxs/ --with-apache=/usr/include/httpd/ output: checking apxs... no checking apr.h usability... no checking apr.h presence... no checking apr.h... no configure: error: apache portable runtime headers not found. i see headers on both locations mentioned above. any pointers? thanks! i compiled on ubuntu 14.04 after installing , configuring apr-1.5.2 , httpd 2.2.31. compiled in way: ./configure --with-apache='/usr/local/apache2'

PHP jQuery Tag-It - showing label from value list -

i try awesome plugin ( http://aehlke.github.com/tag-it/ ). pass related product , store list of ids mysql. for related product, have list var relatedproducts = [{value:142,label:'canon'},{value:150,label:'nikon'},{value:174,label:'sony'}] i stored value list mysql: related: 142,150,174 how can display related product showing label, insteads of showing related ids? current display: related product: 142,150,174 i want show display list label: related product: canon,nikon,sony could please me here? appreciated!

ios - How to use multiple cell.textLabel.text for multiple tableview? -

i trying create 2 tableviews 1 single uiviewcontroller , here have created 2 tableview if conditional statement operate separate process separate tables. problem need create separate cell.textlabel.text separate tables . whenever clicked cell getting first tableview cell.textlabel.text value. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if (tableview==tableone) { static nsstring *cellidentifier = @"cell"; cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; cell.textlabel.text = [....]; // here applying first table values } if (tableview==tabletwo) { static nsstring *cellidentifier = @"cell"; cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; cell.textlabel.text = [....]; // here applying values } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {

javascript - Type and focus out event in jquery? -

i have written blur() event handle focus out event on text field. code looks this. $("input[type=text]").blur(function (event) { if(this.value){ //do } event.originalevent.handled = true; }); i have situation text-field automatically getting focus text previous page. to give example, in flipkart.com , type text in search field , click search. event handler must execute focus out event. (it happening correctly). in next page, text entered prepopulated in text-field , focus on it. in page, if action, text-field lose focus , same event gets called again. don't need happen. is there way avoid this? combining 2 event handlers? please help. change code function bound element after user explicitly interacts element so: $("input[type=text]").on('keyup keypress change click', function() { $("input[type=text]").blur(function(event) { if (this.value) { //do alert('blur called af

wordpress - download failed, couldn't connect to host -

i haven't been able install new plugins or updating plugins after upgrading wordpress 4.3 on ubuntu server 12.04.5 32bit machine. clicking on "update" link that's associated specific plugin. , update less minute. time, took long , @ end, threw out error "download failed, couldn't connect host". then, thought , guessed might new wordpress 4.3. downgraded previous version 4.2.4 , tried update plugin needs updating. took long , in end, gave same error message. the strange thing haven't made changes ubuntu server in terms of firewall @ all. my installed php version 5.5.25 , apache 2.4.12. the permission of wp-config.php 644. i don't know else look. appreciated. thank in advance did install correct .dll files in system directory? uninstall program , try running system repair , .dll file patcher

Need an example of Record Syntax in mercury -

i new mercury , trying wrap head around record syntax , reference manual place have encountered , leaves me mystified: term ^ field1(arg1) ^ field2(arg2, arg3) equivalent field2(arg2, arg3, field1(arg1, term)). could please real-world example? record syntax syntax sugar, , manual trying explain how transformation record syntax mercury's normal syntax works. fine if you're trying find out how implement record syntax, not helpful if want learn how use it. i recommend ignoring (arg1, ...) stuff in parenthesis - i'm not sure if it's part of syntax , i've never seen use it. lets create structure representing points on cartesian plane. :- type point ---> point( pt_x :: int, pt_y :: int ). pt_x , pt_y field names allow retrieve values of point's fields. example: format("the point's x coordinate is: %d\n", [i(point ^ pt_x)], !io), format("the point

ios - Tabbed view controller, scrollToItem in collection view not working after switching tabs -

i have tabbed bar view controller. main view controller has collection view. want animate list of cells contained in array so: // called in viewdidappear func animatenewachievements() { if let indexpath = newachievementindexpaths.first { collectionview.scrolltoitem(at: indexpath, at: .bottom, animated: true) } } // delegate method func scrollviewdidendscrollinganimation(_ scrollview: uiscrollview) { if let indexpath = newachievementindexpaths.first { if let cell = collectionview.cellforitem(at: indexpath) as? trophycollectionviewcell { cell.animate(completion: { if self.newachievementindexpaths.count > 0 { self.newachievementindexpaths.removefirst() } self.perform(#selector(self.animatenewachievements), with: nil, afterdelay: 0.4) }) } } } as can see if cycle through index paths in newac

visual studio - How to get rid of Infragisitic 6.1 installation Error 1609 - ASPNET is not a valid user or group? -

i getting error 1609 - aspnet not valid user or group while installing infragistic 6.1.. i'hv iis7 & visual studio 2013 installed.. while creating aspnet user using command getting error: aspnet_regiis not recognized internal or external command.. idea? c:\windows\microsoft.net\framework\v1.1.4322 aspnet_regiis –i if still need assistance how fix mentioned issue, find information fixing 1609 error, in forum below: http://www.infragistics.com/community/forums/p/65220/330538.aspx thanks.

php mysql_fetch_array() not working as expected -

$result = mysql_query($strsql); foreach($bestmatch_array $restaurant) { while($row = mysql_fetch_array($result)) { if($restaurant == $row[0]) { $value = $row[1]; } } } what trying sort result of array formed query according values stored in $bestmatch array. i don't know doing wrong 4th line seems run once. please guys. thanx in advance. php mysql_fetch_array() not working expected your expectation not right. foreach($bestmatch_array $restaurant) { // loop run first iteration of foreach. while($row = mysql_fetch_array($result)) { } // has been fetched now. } that logically incorrect sequence. you expect inner loop called on , on again many times have outer loop run record fetch not work that. outer loop's first run rows in $result fetched , since

javascript - What is the difference between jQuery Mobile and PhoneGap -

i developing mobile application using jquery mobile. using can left .html , .js , .css files. , in order make run in smartphones, need create stand alone application using toolkits such phonegap. so, if develop whole application using phonegap instead of using jquery mobile. possible? jquery mobile ui framework building web application , phonegap javascript framework allows access native device functionality. for example consider cases. case 1: can develop mobile web app using jquery mobile. case 2: if want access device hardware native device functionality, have phone-gap in addition ui framework can not jquery mobile. can package different platform (like ios, android etc) i.e., hybrid app. approach depends on requirement.

android - Connecting to database, possible options for multiple platforms -

i developing application uses database written mssql. once project complete, database should uploaded on database service provider (e.g ms azure) supply android/ios application data sets needed. now, starting , learning databases (i quite new dbs/sql, have experience in c++), i'd develop "core functions" reading, searching , writing specific data on db in way can use code "core" of apps. best way this? way connect db should used avoid troubles when moving online-server? i've done quite research on issue , found lot ado.net, sql server native client, odbc , sqlapi. didn't manage find out solution appropriate use in case libraries , drivers available multiple platforms. however, visual studio says 1 can reuse code on multiple platforms. possible these apis , extensions? hope can me, in advance! the recommended approach far develop api. need separate virtual machine or place host api. use rest commands interact api provide authentication, autho

facebook javascript sdk - Can't retrieve Fb user object (email, etc) only Id and Name -

i've been trying retrieve facebook email , whole user object according facebook api guide. i'm trying code but, returns id , name (function(d,s,id) { var js, fjs = d.getelementsbytagname(s)[0]; if(d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "http://connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); window.fbasyncinit = function() { fb.init({ appid : 'xxxxx', cookie : true, xfbml : true, version : 'v2.4' }); } function ingresar() { fb.login(function(response){ validarusuario(); }, {scope: 'public_profile, email, user_friends', return_scopes: true}); } function validarusuario() { fb.getloginstatus(function(response) { if(response.status == 'connected') { fb.api('/me

javascript - Jsxgraph circle dragging of its body area -

i new jsxgraph. usecase drag circle body or area, dragging inside of circumference or area. found of jsxgraph circle event drag, mousedown etc,work when click on circumference border , not fire when click inside circle. can point me in right direction? circles can constructed attribute hasinnerpoints this. example: var circ = board.create('circle', [...], {hasinnerpoints: true});

mysql - Populate empty dates -

my database table structure like stats_id stats_date stats_visitors stats_visits 1 2015-08-01 10 20 2 2015-08-03 12 21 3 2015-08-04 14 24 4 2015-08-07 15 21 what easiest way add empty stats date. example missing 2015-08-02 should be: stats_id stats_date stats_visitors stats_visits 1 2015-08-01 10 20 5 2015-08-02 0 0 2 2015-08-03 12 21 3 2015-08-04 14 24 6 2015-08-05 0 0 7 2015-08-06 0 0 4 2015-08-07 15 21 i can check every day if has data , populate when have on 10k rows not idea. if use check each day generate on 10k queries. is there easy way can this? this should out. insert table1 select '',selected_date,'0','0' (select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i)

Need to recover BIGSERIAL "primary key" value from an Informix stored procedure -

i have following stored procedure: create procedure eukno(pk bigint, requestee varchar(20)) returning bigint; define eunid bigint; insert ent_uniq (eunid, eunreq) values (pk, requestee); return eunid; end procedure; i value inserted table need primary key value eunid returned exact value during insert. eunid bigserial primary key start value of 9999000000, on first insert, eunid automates produce 9999000001 stored procedure executed parameters (0, 'username') , primary automatically increased one. need retrieve exact uniq eunid @ time of insert many users request id in single moment. the dbinfo('serial8') function returns value of key last serial8 column. you're inserting bigserial; need use dbinfo('bigserial') instead. sql[2163]: create procedure eukno(pk bigint, requestee varchar(20)) > returning bigint; > insert ent_uniq (eunid, eunreq) values (pk, requestee); > return dbinfo('bigserial'

javascript - Fetching data from many input fields using getElementsByTagName() method -

<!doctype html> <html> <head> <script> function getelements() { var v = document.getelementbyid('view'); var x=document.getelementsbytagname("input"); for(var i=0; i<x.length; i++){ v.innerhtml = x[i].value+"<br>"; } } </script> </head> <body> <input type="text" size="20"><br> <input type="text" size="20"><br> <input type="text" size="20"><br><br> <input type="button" onclick="getelements()" value="how many input elements?"> <p id='view'></p> </body> </html> this code want fetch values of fields , iterate them below in "p" tag kept showing me value of last input submit value. the nature of program me fetch data many inputs elements including file, upload field , submit them server script. you need ch

animation - Android animateLayoutChanges and anchored fab flicker -

i have framelayout replace on activity create fragment show , hide of views layout animation change, works well, have floatingactionbutton anchored frame layout , when layout animates on hiding or showing view fab flickers, if there no animation , views dissapeared immediately, goes , animates view. this breaks smoothnes of whole transition question did else experience this? , there fix or workaround bug?

c# - WPF: How to bind the result of an OpenFileDialog to a TextBox.Text, which is already bound -

i have listbox, bound list of objects , in datatemplate of listbox have textbox, bound property of objects. have button in datatemplate, too, opens openfiledialog. want bind result of openfiledialog textbox.text, result shown in textbox , value of object, bound textbox changes result. the xaml: <listbox name="mylist"> <listbox.itemtemplate> <datatemplate> <dockpanel> <button name="btnopen" click="btnopen_onclick"/> <textbox name="txtpath" text="{binding path=prop2, mode=twoway}"/> </dockpanel> </datatemplate> </listbox.itemtemplate> </listbox> the code behind: private void btnopen_onclick(object sender, routedeventargs e) { openfiledialog filedialog = new openfiledialog(); filedialog.multiselect = false; dynamic result = filedialog.showdialog(); if (result == true)

Why arguments in all JavaScript Documentation are written like this? -

json.stringify(value[, replacer[, space]]) all on mdn, documentation represents arguments value[, replacer[, space]] . reason behind it? what purpose of square brackets? square brackets used lot of programming environments, command line tools , documentation show arguments optional. the double brackets mean supplying 1 of optional arguments doesn't force provide value others. that means replacer optional, , if provide it, space optional again, , can't specify space without specifying replacer . this opposed to: (sample) json.stringify(value[, replacer, space]) where need provide value space if provide value replacer .

ios - How to add a UIbutton in a TableViewCell? -

i tried adding uibutton tableviewcell , realized can't add outlet because cell repeating. how can access uibutton iboutlet in .m file? just declare class extenson in tableviewcell.m file above @implementation scheduledatecell below @interface tableviewcell () { } @end then in xib can add button , right-click drag button .m file in assistant editor mode

android - In parse, pushes sent is always 0 -

for push notifications i've tried sending, status "succeeded" none have arrived on device. in parse dashboard, installations not empty (there 5). "client push enabled" set "yes" (tried sending both yes , no). i have tried sending through parse dashboard , through django. have tried targeting "everyone" , "channels". in cases status green "pushes sent" 0. this question has been asked couple of times none of answers working me. here question closest situation mine: parse pushes not being sent question however, not answered. i have face issue. reason of 0 recipients push sent because in present case push never sent of recipient although seeing entries in installation table. reason: devicetoken field must missing in case. if there installation entries in table these entries missing devicetoken parse not send push notification because devicetoken mandatory. you have add following permissions in man

javascript - Is there any workaround to the Mongo _id field type limitation? -

i using meteor pre-existing database uses custom objects in _id field. have defined structure meteor this: _id: { type: object, label: "id" }, "_id.templateid" : { type: string, label: "template id", optional: false }, "_id.locale": { type: string, optional: false }, however, when try use collection, error stating "meteor not support objects other objectid ids." is there workaround allow me use collection in meteor without having change existing database? you trying use object literal id composition, meteor supports string , objecid string preferable because every package rely on id information assume strings. also, built in accounts system cannot work other simple string id's.

How to parse the variables from a xml in php -

suppose xml content url in php variable (e.g $new ). below example of xml content: <getresult> [{"abc": "123","xyz":"234","mno":"we4r5t"}] </getresult> when parsing of xml content in php like:- $xmlobj = simplexml_load_string($new); error_log($xmlobj->getresult); i [{"abc": "123","xyz":"234","mno":"we4r5t"}] but want retrieve inner content tag, e.g retrieve value of abc or xyz or mno . how can that? [{"abc": "123","xyz":"234","mno":"we4r5t"}] that's not xml-string it's json object. should parse json_decode ! http://php.net/manual/de/function.json-decode.php

javascript - WebCache google and angular error -

i have problem angularjs , googlecache . when access page google cache, console have next error: uncaught typeerror: cannot read property 'replace' of undefinedcb @ angular.js:11552$get @ angular.js:12203e @ angular.js:5198(anonymous function) @ angular.js:5317d @ angular.js:4559e @ angular.js:4696(anonymous function) @ angular.js:5317d @ angular.js:4559e @ angular.js:4696(anonymous function) @ angular.js:5320m @ angular.js:305eb @ angular.js:5316d @ angular.js:1437yc @ angular.js:1735zd @ angular.js:1374(anonymous function) @ angular.js:20798o.callbacks.j @ jquery-2.1.0.min.js:2o.callbacks.k.firewith @ jquery-2.1.0.min.js:2o.extend.ready @ jquery-2.1.0.min.js:2i @ jquery-2.1.0.min.js:2 without google cache , site works perfectly. it looks google cache works different crawler https://www.seroundtable.com/fetch-as-google-renders-angularjs-as-cache-html-page-21413.html

computer vision - Recover Pose OpenCV 3.0 -

i have calibrated pinhole camera using opencv 3.0 , got 4 intrinsic parameters (f_x,f_y,u_0,v_0) plus distortion coefficients. using calibration, estimate essential matrix 2 images @ different positions. want recover (r|t) using recover pose function opencv 3.0. interface of function expects single focal length, have 2 calibration procedure. how can focal length f=f_y/s_y = f_x/s_x (definition according opencv) f_x f_y can use recover pose function? you can use horizontal focal length f_x. ratio f_y/f_x pixel aspect ratio, estimate squareness of pixels. note that, unless have absolute scale reference in image pair (e.g. object of known size), can recover pose scale, is, r , s*t unknown scale s.

r - Installation of package ‘rjags’ had non-zero exit status -

s.o.: linux ubuntu 14.04 lts r: r version 3.2.1 (2015-06-18) -- "world-famous astronaut" copyright (c) 2015 r foundation statistical computing platform: i686-pc-linux-gnu (32-bit) when try install package rjags , following fatal error: install.packages("rjags") installing package ‘/home/marco/.rkward/library’ (as ‘lib’ unspecified) --- please select cran mirror use in session --- trying url 'http://mirrors.softliste.de/cran/src/contrib/rjags_3-15.tar.gz' content type 'application/x-gzip' length 66879 bytes (65 kb) ================================================== downloaded 65 kb * installing *source* package ‘rjags’ ... ** package ‘rjags’ unpacked , md5 sums checked checking prefix checking jags... no configure: error: "location of jags headers not defined. use configure arg '--with-jags-include' or environment variable 'jags_include'" error: configuration failed package ‘rjags’ * removing ‘/home/marco/.rkward/lib