Posts

Showing posts from July, 2013

javascript - how to show data from json to ui-grid in angular ui-grid -

i getting json django , want show in angular ui-grid getting error: error: coldef.name or coldef.field property required preprocesscoldef@http://127.0.0.1:8000/static/buddy/js/ui-grid.js:3771:1 buildcolumns/<@http://127.0.0.1:8000/static/buddy/js/ui-grid.js:3630:7 buildcolumns@http://127.0.0.1:8000/static/buddy/js/ui-grid.js:3629:5 datawatchfunction@http://127.0.0.1:8000/static/buddy/js/ui-grid.js:2749:27 $watchcollectionaction@http://127.0.0.1:8000/static/buddy/js/angular.js:15693:13 $rootscopeprovider/this.$get</scope.prototype.$digest@http://127.0.0.1:8000/static/buddy/js/angular.js:15826:23 $rootscopeprovider/this.$get</scope.prototype.$apply@http://127.0.0.1:8000/static/buddy/js/angular.js:16097:13 done@http://127.0.0.1:8000/static/buddy/js/angular.js:10546:36 completerequest@http://127.0.0.1:8000/static/buddy/js/angular.js:10744:7 requestloaded@http://127.0.0.1:8000/static/buddy/js/angular.js:10685:1 i want show attributes "fields" the json is: [{&q

php - Adding dots between numbers of pagination -

i have written code pagination in php , ajax table. in each page show 8 rows of table. works fine until here. what need make pagination looks series of numbers , dots between them (1 2 3 .... 27 28 29) . i have 2 files pagination: conf.php <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" id="font-awesome-style-css" href="http://phpflow.com/code/css/bootstrap3.min.css" type="text/css" media="all"> <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.2.min.js"> </script> </head> <body> <div> <p> table <br/> </p> <div id="target" >loading ...</div> <?php include('dbconnect.php'); $limit =

java - menu layout for the navigation menu is not showing up in the navigation drawer -

it's hard figure out problem because there no syntax errors. i'm able slide navigation menu, menu layout not working. here's code. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.isaacdixon.pro3.mainactivity"> <linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" > <include android:layout_height="wrap_content" android:layout_width="match_parent" l

swift - Document saved on iCloud Drive seems not to be downloaded on iOS -

i'll let user save backup of data using icloud drive. works good. if switch icloud drive enabled device, can't read file. i can see backup file within icloud drive app, it's not downloaded, (it shows "download icloud symbol). is possible force download of files available within directory if user wants restore backup? using swift 2 on ios 8/9. i've solved myself. i'll check whether backup file available , if needs downloaded. if so, i'll start download , inform user check in few seconds. not best solution, works. func checkanddownloadbackupfile() -> bool{ if(iclouddocumentsurl != nil){ let file = iclouddocumentsurl!.urlbyappendingpathcomponent("backup.file") let filemanager = nsfilemanager.defaultmanager(); if !filemanager.fileexistsatpath(file.path!){ if filemanager.isubiquitousitematurl(file) { let alertview:uialertview = uialertview() alertview.titl

c++ - Should Taking the Address of a Templatized Function Trigger its Compilation? -

i got official answer this question decltype should not trigger function compilation. in fact decltype on function declared not defined legal. next question, should taking address of function trigger compilation of function? take this example : template <typename t> void foo(t&& x) { x.func(); } int main() { auto bar = &foo<int>; } all compilers i've tested fail error like: request member func in x , of non-class type int but if define foo , don't declare it, code compiles fine. can provide me official source on whether taking address of function should require it's compilation? 3.2/2: an expression potentially evaluated unless unevaluated operand (clause 5) or subexpression thereof. ... non-overloaded function name appears potentially-evaluated expression or member of set of candidate functions, if selected overload resolution when referred potentially-evaluated expression, odr-used, unless pure

Facebook Ads Api: Can you Get Timeseries of CPI in 15 minutes intervals? -

i've started playing api's first time , first attempt facebook ads api. i'm looking through documentation , can see how pull cost per action data. right i'm interested in cpi (cost per install) data specific campaign, ad set , ad in 15 minute intervals. does know if possible current api? you can reporting stats through ads insights api: https://developers.facebook.com/docs/marketing-api/insights/v2.5 as mentioned, can cost per install data requesting cost_per_action_type field in request. for instance, call v2.5/<ad_set_id>/insights?fields=['cost_per_action_type'] would have cost of mobile app installs part of response { "data": [ { "cost_per_action_type": [ { "action_type": "mobile_app_install", "value": ... } ], "date_start": ..., "date_stop": ... } } you can make api calls @ discretion long you're

centos7 - Docker: transaction check error -

i trying install docker , following https://get.docker.com/ i on centos7 -bash-4.2$ cd -bash-4.2$ wget -qo- https://get.docker.com/ | sh + sudo -e sh -c 'sleep 3; yum -y -q install docker-engine' transaction check error: file /usr/lib/systemd/system/blk-availability.service install of device-mapper-7:1.02.107-5.el7_2.5.x86_64 conflicts file package lvm2-7:2.02.105-14.el7.x86_64 file /usr/sbin/blkdeactivate install of device-mapper-7:1.02.107-5.el7_2.5.x86_64 conflicts file package lvm2-7:2.02.105-14.el7.x86_64 file /usr/share/man/man8/blkdeactivate.8.gz install of device-mapper-7:1.02.107-5.el7_2.5.x86_64 conflicts file package lvm2-7:2.02.105-14.el7.x86_64 error summary ------------- anyone know error means , how resolve it? i've updated with: sudo yum update now docker command works now

html - PHP - Form handling -

on clicking submit query button, should display information user has entered not happening here. mistake? here html code: <html> <body> <form method="post" action="temp2.php"> name: <input type="text" name="name" ><br> e-mail: <input type="text" name="e-mail" ><br> <input type="submit" > </form> </body> </html>` and temp2.php file: <html> <body> name: <?php echo $_post["name"]; ?><br> e-mail: <?php echo $_post["e-mail"]; ?><br> </body> </html> this image of output when submit button clicked. (now know not going on here) op: "i had files in php folder , not in htdocs folder. it's , running now, thank everyone." link comment having used error reporting ha

Return String from Server PHP File to Client Web Page -

there's lots on can't find works in case. following 2 test files php , html. html file has 2 text boxes button each. following occur: the upper textbox data sent php file when 'send' button clicked. this works! the php file opens text file , appends data. this works! on clicking 'receive' button, php file opens text file , reads data. this works! now i'm stumped. how data php file lower textbox in in html file? note: i'm using jquery.redirect plugin transferring data. html file: <!doctype html> <html lang='en'> <head> <meta charset="utf-8"> <script src='jquery-2.1.4.js'></script> <script src="jquery.redirect.js"></script> <title>test</title> </head> <body> <input id='send' type='text'></input> <div id='btnsend'><center>send</center></div> <i

javascript - How can I get id of span and make it display none which is dynamically generated? -

i have created span tags dynamically , appended div. want id, 1 select , delete it. jquery tagit. below using not working. see id can when click particular span. $('span').on('click', function (e){ alert(e.target.id); }); you don't need id (and span may not have one), have reference element: this . that's standard jquery behavior. (in fact, it's standard across various ways can hook events without jquery too.) so $('span').on('click', function() { $(this).remove(); // removes 1 clicked }); (or, yes, add e , use e.target : $(e.target).remove(); ) re comment: i tried using code giving alert click event not firing. that suggests span s in question don't exist of when code runs, , don't end hooking click event. to deal that, want delegated handler: in dev tools, right-click 1 of these spans , find common ancestor have does exist of when code runs. (in worst case, document , it's better scope

c++ - Who's function get called when calling f1() through Derived::f2()? -

#include <iostream> #include <string> using namespace std; class base { public: base(const string& s): str(s) {cout<<"base::ctor\n";} base(const base& b): str(b.str) {cout<<"base::copy ctor\n";} virtual ~base() {cout<<"base::dtor\n";} void f1() {cout<<"base::f1()\n"; f2();} //2 orders virtual void f2() {cout<<"base::f2()\n";} private: string str; }; class derived : public base { public: derived(const string& s): base(s) {cout<<"derived::ctor\n";} derived(const derived& d): base(d) {cout<<"derived::copy ctor\n";} ~derived() {cout<<"derived::dtor\n";} virtual void f1() {cout<<"derived::f1()\n"; f2();} void f2() {cout<<"derived::f2()\n"; f1();} //jumps here leaf's f1() }; class leaf : public derived { public: leaf(const string& s): derived(s) {cout<<"leaf::ctor\

What is the difference between [ ] and [[ ]] in R? -

this question has answer here: the difference between [] , [[]] notations accessing elements of list or dataframe 9 answers > levels(state.region)[2] [1] "s" > levels(state.region)[[2]] [1] "s" they return same value, don't know difference between them. [] = returns object of same class (out of basic object classes), can select more 1 element of object [[]] = can extract 1 element list or data frame, returned object (out of basic object classes) not list/dataframe

amazon ec2 - Continuos deployment to a autoscaling group in private subnet -

i've elb in public subnet using autoscaling group comprising of 3 private subnets, each running 2 ec2 instances , nat instance in public subnet. due restrictions can't use aws codedeploy or code pipeline or s3. now question how can still deploy latest github commits each of ec2 instances automatically? any suggestions welcome indeed. assuming have windows machines in auto scaling group, create , configure task in image used auto scaling copies latest version of application deployment server. can run task @ start of group instances.

wordpress - programmatically create transaction memberpress -

i found following snippet on github: https://gist.github.com/supercleanse/8010675 if(is_plugin_active('memberpress/memberpress.php')) { add_action( 'user_register', 'mp_auto_enroll' ); //add_action( 'gform_user_registered', 'mp_auto_enroll', 10, 4 ); function mp_auto_enroll($user_id, $user_config=array(), $entry='', $user_pass='') { $txn = new meprtransaction(); $txn->user_id = $user_id; $txn->product_id = 8; // todo: make sure change value whatever product_id $txn->trans_num = uniqid(); $txn->status = meprtransaction::$complete_str; $txn->gateway = meprtransaction::$free_gateway_str; $txn->expires_at = 0; // 0 = lifetime, null = product default expiration $txn->store(); } } above code adds non-recurring transaction, how add recurring transaction i tried add $txn->amount = 100; $txn->

java - Facebook Messenger like Activity? -

i trying make app similar facebook messenger has chat heads. done chat heads part, , want display window when user taps on chat head messenger. (look here: http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2013/04/fbscreens2.jpg not own of images) can tell me how done - activity (because can't see in task manager), or dialog fragment? how can make similar occupies less space screen size. also, soft keyboard pushes current white box , goes outside screen space. what call it? i'm new android, please can me. thanks. that feature called floating windows. this article has great explanations. , this one more beginners, step-by-step instructions. here libraries, might have need: klinker24/floatingwindowdemo pingpongboss/standout marshallino16/floatingview

C++ - Failing to parse CSV into my struct -

i have csv following format: date,fruit,quantity1,quantity2,quantity3 2016-07-14,banana,3,20,6 2016-07-14,banana,3,50,15 2016-07-14,banana,0,25,15 2016-07-14,banana,3,25,6 2016-07-14,apple,3,10,20.5 2016-07-14,apple,0,30,5 2016-07-14,apple,0,5,30 2016-07-14,peach,3,10,30.2 2016-07-14,peach,3,40,4 2016-07-14,peach,3,10,12 2016-07-14,peach,0,10,8 2016-07-14,peach,3,200,3 i want parse file , store in struct. getting stack overflow error. failing exactly? because of clashing data types in struct? of data types float , i'm trying use getline , temporary string variable store info. here complete code: #include "stdafx.h" #include <iostream> #include <fstream> #include <sstream> #include <string> using namespace std; struct fruitinventory { string date; string fruit; float quantity1; float quantity2; float quantity3; }; int main() { ifstream myfile; myfile.open("fruit_inventory.csv", ios::in);

c# - Force any task to be attached to parent -

i'm trying create extension method make task attached parent. extension code: internal static class taskhelpers { public static task attachtoparrent(this task task) { var tsc = new taskcompletionsource<task>(task.creationoptions & taskcreationoptions.attachedtoparent); task.continuewith(_ => tsc.trysetresult(task), taskcontinuationoptions.onlyonrantocompletion); task.continuewith(t => tsc.trysetexception(task.exception ?? new aggregateexception(new applicationexception("unknown"))), taskcontinuationoptions.onlyonfaulted); task.continuewith(t => tsc.trysetcanceled(), taskcontinuationoptions.onlyoncanceled); return tsc.task.unwrap(); } } test code: static void main(string[] args) { var cancellationtokensource = new cancellationtokensource(); var task1 = task.factory.startnew(() => { var task2 = task.factory.startnew(() => {

ios - KVO for scroll start & end in UIScrollView -

is there way use kvo (key value observing) detect scrollviewwillbegindragging , scrollviewdidenddecelerating in swift? edit: tried scrollview.addobserver(self, forkeypath: "dragging", options: nskeyvalueobservingoptions.new, context: nil) but it's never called. if observe instance "contentoffset" in same way, it's called. kvc compliant? you can add observers using nsnotification center. in viewdidload of vc, override func viewdidload() { super.viewdidload() nsnotificationcenter.defaultcenter().addobserver(self, selector: #selector(self.informbegindragging), name: "begin", object: nil) nsnotificationcenter.defaultcenter().addobserver(self, selector: #selector(self.informenddragging), name: "end", object: nil) } you can in following 2 methods func informbegindragging() { //do } func informenddragging() { //do } and these 2 methods triggered when scroll view begin dragging

java - getBaseContext() error for parsing data -

this code attempt registation.class android studio application parsing data.my code keeps giving me errors under getbasecontext() code @ end , have no idea why think looks ok!!! code lab should correct keep on getting errors!!!! can tell me?? appreciated! thank public class attemptregistration extends asynctask<string, integer, string> { int success; string message = " "; @override protected string doinbackground(string... args) { try { map<string, string> params = new hashmap<string, string>(); params.put("tag", "register"); params.put("username", args[0]); params.put("password", args[1]); params.put("email", args[2]); // httputility.sendpostrequest(params); // string response = httputility.readrespone(); jsonobject jobj = null; try { jobj = new jsonobject(response); succ

php - How to check if a folder of specific name exists in zip file or not? -

i have zip file open using php ziparchive function , later need check if folder exists inside zip? for example i have abc.zip file. check if there sub-folder "xyz" in folder "pqr" inside zip file, if extracted abc / pqr / xyz sorry if not explained properly.. i did researching , that's came it's working , added comments make easy understand <?php $zip = new ziparchive; $dir = __dir__ . '/test'; // directory name $zipfilename = __dir__ . '/ahmad.zip'; // zip name $filename ='ahmad.php'; //file name // unzip archive directory $res = $zip->open($zipfilename); if ($res === true) { $zip->extractto($dir); $zip->close(); } else { echo 'failed, code:' . $res; } // search file in directory $array = (scandir($dir)); if (in_array($filename, $array)) { echo "file exists"; } else { echo "file doesn't exist"; } // delete directory after search done $it = new recu

r - Drop factor from formula when less than two levels -

i want able drop term formula based on whether or not factor has less 2 levels. my setup want run large number of same logit models different subsets of data. problem that, subsets, not factors may take 1 value. here example: depvar <- sample(0:1, 100, replace=t) bin1 <- rep(1, 100) cont1 <- rnorm(100) df <- data.frame(depvar=depvar, bin1=bin1, cont1=cont1) formla <- as.formula("depvar ~ bin1 + cont1") logit.reg <- glm(formla, data=df, family=binomial(link=logit)) i able somehow drop bin1 formula automatically when takes 1 value. seems me simple if/else should suffice: if(length(unique(df$bin)) > 1) { formla <- as.formula("depvar ~ bin1 + cont1") } else { formla <- as.formula("depvar ~ cont1") } note bin1 not factor in example (can use as.factor() coerce 1 though)

Are there any differences in implementation between Okta's SAML Java Toolkit and OpenSAML? -

i integrating saml custom java web-app in order put behind okta. want use saml java toolkit provided okta. there many examples on internet of opensaml implementations in order me general idea of how begin. however, wondering if there significant differences between opensaml , saml toolkit provided okta. thanks! opensaml set of open source c++ & java libraries meant support developers working saml protocol. current version supports saml 1.0, saml1.1, , saml2.0 protocols. in other words, opensaml library handling low level samlx.x protocol implementations. saml toolkits free , open-source, designed shorten development time , reduce complexity implement saml2.0 enabled web-apps. saml java toolkits okta uses opensaml java libraries implement minimal features of saml2.0 protocol vendors deploy saml service provider (sp) server , protect web-apps. otherwise, vendor has employ developers has know , understand saml2.0 specification , use opensaml or other similar lib

Csr matrix (scikit-learn svm.SVC coef_ attribute) -

i have sklearn.svm.svc object , train data. need first n values of v = tfidfvectorizer() train_data = v.fit_transform(data) clf2 = svc(kernel='linear') clf2.fit(train_data, train_target) print clf.coef_ in order valuable words in set, need absolute values of clf2.coef_ sparse matrix. how can first n words absolute values?

javascript - Get time from date and time using Regex -

how extract 12:05 am 7/16/2016 12:05:00 am using regex? i've made far test = "7/16/2016 12:05:00 am" test.match(/^(\s+) (.*)/)[2] > "12:05:00 am" but can't figure out how remove seconds. plus, if there's simpler/more efficient way of doing i'm trying do, please let me know. i rather not rely on third-party libraries moment.js note: desired output 12:05 am , not 12:05 look explicitly digits , colon, lopping off last 2 before matching am/pm. make second hour digit optional, in case matching against "3:14:16 pm": var test = "7/16/16 12:05:00 am"; var matches = test.match(/(\d\d?:\d\d):\d\d(\s[ap]m)/i); var time = matches && (matches[1] + matches[2]); // time === "12:05 am" just note fullness of regex, use curly braces determine number of digits count (i didn't above, because it's more characters in end when it's 1-2) . both following , above match same string: var m

html - CSS responsives, close menu automatically -

i new css, working on responsive page. have menu bar on left side of screen, can retracted on click on button, want make once screen size reaches size, menu retract automatically without user having click on button. <a href="#" class="menu-toggle icon" id="left-menu-toggle" title="menu"> <i class="fa fa-bars"></i> </a> this menu button. you hide menu using media query , display none. you can adjust max-width based on size of device want menu hide on. styles applied devices size of 480px or smaller. something this @media screen , (max-width: 480px) { #left-menu-toggle { display:none; } } additionally use min-width:481px , have menu display:block on larger screens. know mobile first because you're targeting css towards mobile devices , changing things larger devices.

Having trouble understanding scope and variables using DOM in Javascript -

i working on hangman game using javascript only. class. noob @ javascript , dom please kind. @ point, want print out something, really, in console log. have been @ days , hours removing of functions , game processes except few shown here try work. thought process variables not change within loop , not need dynamically updated in html not need properties of hangman game. but, when run following code working console.log, userguess not defined. thought defining assigning value of keyup event. if make userguess property of hangman game , update rest of code hangmangame.userguess, of these unexpected token errors. any thoughts? //variables=============================================================== var hangmangame = {presidents: [ "washington", "adams", "jefferson", "madison", "monroe", "jackson", "vanburen", "harrison", "tyler", "polk", "taylor",

php - authorize.net laravel empty response -

i trying integrate authorize.net laravel shopping cart using php sdk. in sandbox environment currently. have processing transaction (i can see in admin , email) returned response null values. code still little dirty namespace app\http\controllers; use illuminate\http\request; use app\http\requests; use net\authorize\api\contract\v1 anetapi; use net\authorize\api\controller anetcontroller; class paymentcontroller extends controller { // public function authnet_chargecard() { $merchantauthentication = new anetapi\merchantauthenticationtype(); $merchantauthentication->setname(env('authnet_id')); $merchantauthentication->settransactionkey(env('authnet_key')); $refid = 'ref' . time(); define("authorizenet_log_file", "phplog"); // create payment data credit card $creditcard = new anetapi\creditcardtype(); $creditcard->setcardnumber("411111111

javascript - How to force TypeScript exports to the end of the JS output? -

i use lot of export statements following, cumulate module's exports @ bottom of file: export { foo1 bar1, foo2 bar2, ... } lately have learned that... let foo : number = 0; export { foo bar } ...is not @ same as... let foo : number; foo = 0; export { foo bar } ...because latter delivers undefined in exports.bar . happens because compiled javascript has export statement of exports.bar = foo before assignment. find hardly intuitive. read on typescript module pages, seem miss description of behaviour. there? is there way force output's export statements @ bottom rather right after declaration? thanks. this sounds more bug in typescript. future reference, typescript 1.8 compiles following code: let foo : number; foo = 0; export { foo bar } into javascript: "use strict"; var foo; exports.bar = foo; foo = 0; i tried typescript 2.0 beta, , seems fixes it: "use strict"; var foo; exports.bar = foo; exports.bar = foo = 0;

aggregate - SWI Prolog usage of agregation -

i created simple database on swi prolog. task count how long each of departments work depending on production plan. finished, don't know how sum results. getting this department amount b 20 a 5 c 50 c 30 how can transform this? b 20 a 5 c 80 my code https://gist.github.com/senioroman4uk/d19fe00848889a84434b the code provided won't interpret count predicate on account of bad format. should rewrite count:- instead of count():- . far know, zero-ary predicates need defined this. second, count predicate not collect results in list upon operate. here's how can change collect department-amount pairs in list findall : count_sum(depamounts):- findall((department,sum), ( productionplan(finishedproduct, amount), resultof(finishedproduct, operation), executedin(operation, department, time), sum amount * time ), depamounts ). then, on list, can use swi-p

sql - Extract Table's Data(including BLOB and CLOB Field's Data) from Source Database and import data to Destination Database -

regularly extracted (source database) table’s data flat file (.dat) via spooling in sql*plus tool in oracle database , import extracted data destination database (client database , importing client work). here problem of tables (more 20 tables) having blob , clob fields example table name: test_blob_clob id name address blob_col clob_col ------------------------------------------------------------- 1001 sanjay chennai audio file more 32k text values 1002 ragav mumbai pdf file more 32k text values 1003 vijay delhi word file less 32k text values 1004 sam nagpur txt file more 32k text values note: in blob_col files loaded in database , files locally kept in server computer (only path has been indicated) i have googled , searched here everywhere seeing single image or audio or pdf file extc has been extracted blob field "select blob l_blob test_blob_clob id = 1005;" in plsql procedure. i dont need s

spring mvc - implementing a database browser elm-lang -

i learning use elm building ui. need add new functionality in our existing application uses extjs , spring mvc. first of all, relatively easy task add elm based ui extjs based ui ? possible use spring mvc backend ? there sample applications use spring mvc , elm. have not found any. tips on how go introducing elm existing extjs , spring mvc application. first of all, relatively easy task add elm based ui extjs based ui ? it should easy. elm can embedded within div. please take @ interop guide . is possible use spring mvc backend ? the easiest way implement json rest-full api spring , consume api elm app. elm architecture tutorial example 5 shows how consume json api. (it uses api provides random cat gif) any tips on how go introducing elm existing extjs , spring mvc application. isolate section become responsibility of elm sub-app. implement views , actions of section in elm using elm architecture tutorial.

What is the advantage of using a WCF service instead of a WCF library if I am going to host a WCF service in IIS? -

i understand differences between wcf library , wcf service. typically build wcf library , reference wcf service. if going deploy iis, why not deploy wcf library , forget creating wcf service. matter 1 deploy? answering own question: have read doesn't seem matter if deploy wcf library or wcf service. if deploy library, make sure copy contents of app config file web config file. wcf service provide svc file, need if using earlier version of .net framework other 4.0 or later. if deploy service instead of library, app config file service pass content onto web.config file when deployed. pretty sure these differences. 2 people replied question didn't take time read , understand question. got marked possible duplicate, not.

arrays - Append last and first element pure javascript? -

i have menu in html <ul class="main-menu menu-bees" id="menu-main-menu" data-menu-width="1112"> <!-- rowtpl --> <li class="menu-item bees-start active" id="menu-item-0"> <a href="#"> menu 1 <div class="canvas_wrapper"> <canvas class="menu_dashed" height="64" width="501"></canvas> </div> </a> <span class="button_open"></span> </li> <!-- rowtpl --> <li class="menu-item" id="menu-item-1"> <a href="#"> menu 2 <div class="canvas_wrapper"> <canvas class="menu_dashed" height="64" width="501"></canv

jquery - How can I avoid autorepeated keydown events in JavaScript? -

if user holds down key, multiple keydown events fired. usability reasons need use keydown, not keyup, want avoid situation. relevant code following: $(document).keydown(function(e) { var key = 0; if (e == null) { key = event.keycode;} else { key = e.which;} switch(key) { case config.keys.left: goleft(); break; case config.keys.up: goup(); break; case config.keys.right: goright(); break; case config.keys.down: godown(); break; case config.keys.action: select(); break; } }); so when user holds down down key, example, godown() fired multiple times. fire once if user holds key down. use event.repeat detect whether or not event

wordpress - Slider not displaying images but plain text -

i'm trying use slider in different blog pages in wordpress website, doesn't work. when use it, shows plain text: [metaslider id=4281] it seems "blog entries" don't understand metaslider code, because have tried in simple page, , works. here's code of blog entry (single.php) <?php get_header()?> <div id="maincontent"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); //the loop?> <div <?php post_class()?>> <?php if(has_tag()){the_tags( _e('keywords','polaroids') . ': ', ', ');}?><br/> <hr style="border: 0;border-bottom: 1px dashed #dddddd;"></br> <h1><?php the_title()?></h1> <div class="date"><?php /* the_date() */ ?></div> <div class="post-content"><? echo $post->post_content; /*php the_content()*/ ?

Cannot create or delete PayPal sandbox account in Developer account -

i have account on developer.paypal.com , several months ago created 8 sandbox test accounts, both business , personal. now, when go account dashboard > accounts , try either create new account or check delete one, returns generic error message this: "we're sorry, went wrong during account deletion. of test accounts had selected may not have been deleted. please try again." it's been way @ least last month. i've tried different computers, browsers, etc. , return same result. know cause of this? paypal sandbox cannot delete testing account i think issue referring to, , have not been able solve either after multiple emails paypal. tried delete top email screenshot (one manually created) , error message shown @ top of screenshot.

java - unable show chart in xls document using jasper reports -

Image
i new jasper reports . able export data through jasper reports excel sheet. when created pie chart in ireports , showing on preview. when write below code in jsp file view report in jasperviewer , shows data along chart. when try save document (that in jasperviewer, gives many ways of saving report either in pdf or rtf or xls) xls error came in console net.sf.jasperreports.engine.jrexception: cell cannot added. however when remove chart .jrxml file, able export data excel file. read jr chart inserted image in excel document. xls document not taking images. below jsp file: <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1" import="java.sql.*,java.util.*, net.sf.jasperreports.engine.*,java.io.*, net.sf.jasperreports.engine.design.*, net.sf.jasperreports.view.jasperviewer" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html

php - Create Linux Screen session and get its PID -

i'm trying create php wrapper class around linux screen utility. need able start screen session name , pid of screen created. i cannot assume session name unique can't parse session -ls output find pid. based on examples , suggestions around internet, have tried following approach using php's exec() function: screen -d -m -s 'screen_name' 2>&1 & the -d parameter tells screen not fork process, has same pid background process. so, can parse pid output of & background shell operator in format: [<number>] <pid> this command works linux shell (terminates immediately), when run php freezes , browser never loads page. i have tried executing both php's exec() , shell_exec() , it's same result. i have tried lots of different combinations last part of command such ones described here . edit: if use command: screen -d -m -s 'screen_name' 1> /dev/null 2> /dev/null & 2>&1 then php exec

Merging two lists with python? -

i want merge 2 lists : a=['a','b','c'] b=['1','2','3'] i want result : c = ['a1','b2','c3'] any ideas in python 3. thanks! you can use zip() function within list comprehension : >>> ['{}{}'.format(i,j) i,j in zip(a,b)] ['a1', 'b2', 'c3'] or str.join() : >>> [''.join(i) in zip(a,b)] ['a1', 'b2', 'c3']

how to find duplicate field in subdocument array in MongoDB -

i'm trying find way find , remove duplicate object same field in subdocument array. basically collection has schema. [{ "_id": objectid("578953db976cea724bbdbb60"), "units": [{ "description": "a1" }, { "description": "b1" }, { "description": "a1" }, { "description": "c1" }] }, { "_id": objectid("578953db976cea724bbdbb61"), "units": [{ "description": "a2" }, { "description": "b2" }, { "description": "a2" }, { "description": "c2" }] }] i wish find , remove duplicate field same description. so first, need identify "a1" , a2" respectively. thanks. update (output should be): [{ "_id": objectid("578953db976cea724bbdbb60"), "units": [{ "

android - push command instead of cp command when dealing with system root -

i'm using adb move files in android device storage system there way can use push command instead of cp when want transfer folder contain files , folders inside storage system coz push command allows me transfer folders inside main folder cp command transfer files or there other way?? this example : adb shell "su -c ' stop'" adb shell "su -c ' mount -o remount,rw /dev/block/platform/msm_sdcc.1/by-name/system'" adb shell "su -c ' cp /data/local/tmp/system/app/* /system/app'" adb shell "su -c ' cp /data/local/tmp/system/framework/* /system/framework'" adb shell "su -c ' cp /data/local/tmp/system/prive-app/* /system/priv-app'" adb shell "su -c ' cp /data/local/tmp/system/fontes/* /system/fonts'" adb shell "su -c ' cp /data/local/tmp/system/csc/* /system/csc'" adb shell "su -c ' cp /data/local/tmp/system/samsung_962_r1-2_arlsun_xt9_alm3.ldb /syst

excel - Calendar in VBA -

Image
i'm creating vba application ask user start date , end date , output monthly calendar in excel sheets. here, have code asks user month , year , outputs month in excel sheet enter code here sub calendarmaker() activesheet.protect drawingobjects:=false, contents:=false, _ scenarios:=false application.screenupdating = false on error goto myerrortrap range("a1:g14").clear myinput = inputbox("type in month , year calendar ") if myinput = "" exit sub startday = datevalue(myinput) if day(startday) <> 1 startday = datevalue(month(startday) & "/1/" & _ year(startday)) end if range("a1").numberformat = "mmmm yyyy" range("a1:g1") .horizontalalignment = xlcenteracrossselection .verticalalignment = xlcenter .font.size = 18 .font.bold = true .rowheight = 35 end with range("a2:g2") .columnwidth = 11 .verticalalignment = xlcenter .horizontalalignment = xlcenter .verticalalignment = xlcenter .orie

How to solve longEnough?. In Haskell -

longenough n xs : checks if list has more n elements. examples: longenough 2 [1..5] == true longenough 3 [1,2,3] == false longenough 0 [] == false longenough 20 [1..] == true i guess homework , still learning basics i'll start giving hints using recursion instead of foldr (as @dfeuer proposed): first start noting obvious cases: if xs = [] result false (assuming don't care negative n in strange ways) if n = 0 , xs non-empty it's true in other cases have n > 0 xs has more 1 element maybe have recursive idea break last case down? here skeleton: longenough :: int -> [a] -> bool longenough _ [] = false longenough 0 _ = true longenough n (_:xs) = let n' = (n-1) in undefined for cases - if look closely you'll see added more hints on solution. ps maybe want think negative n , should happen ... did not here if know foldr should try implement using foldr too solution seems there no more

Converting library from Python 2.7 to 3.4 -

i'm writing equity calculator poker hands using library deuces hand evaluation https://github.com/worldveil/deuces the library written python 2.7 , can installed command pip install deuces the library works in python 2.7 need switch python 3.4. i wanted use 2to3 convert library files , install library command pip doesn't allow operation how can convert library python 2.7 python 3.4? download library deuces apply 2to3 it manually install how install python library manually if doesn't work nothing would. should rewrite python 3 yourself. yet there other libraries used , habe rewrite them too.

How to create a TOML file from Rust? -

i have collected data vector , need create toml file data. have managed create , open file: let mut file = try!(file::create("servers.toml")); my vector<(string,(string, u32))> contains following data, should in toml. [server.a] ipaddr="192.168.4.1" port no=4476 [server.b] ...... i have lot of data needs written in toml , know toml text file. how encoder used for? this uses toml crate structure , serialization. main benefit values should escaped. extern crate toml; use toml::value; use std::collections::btreemap; use std::io::prelude::*; fn to_toml(v: vec<(string, (string, u32))>) -> value { let mut servers = btreemap::new(); (name, (ip_addr, port)) in v { let mut server = btreemap::new(); server.insert("ipaddr".into(), value::string(ip_addr)); server.insert("port no".into(), value::integer(port i64)); servers.insert(name, value::table(server)); } let mut