Posts

Showing posts from June, 2013

ruby on rails - Validate object based on the owner its parent -

i have has_many through association setup between artist , album models. add album has_many tracks. tracks have has_many through association between artists (i.e. featured artist ) feature model serves join table. i want prevent album artist(s) being featured artist on track. instance: album = album.find_by(name: "justified") track = album.track.first artist = artist.find_by(name: "justin timberlake") track.featured_artists << artist # ^^ should raise error since justin timberlake album's artist model setup class album < activerecord::base has_many :album_artists has_many :artists, through: :album_artists end class track < activerecord::base belongs_to :album has_many :features has_many :featured_artists, through: :features, class_name: "artist", foreign_key: "artist_id" end class albumartist < activerecord::base belongs_to :album belongs_to :artist validates_uniqueness_of :artist_id, sco...

command line - How do I use the -I option of du to ignore all files of a given type? -

hello running os x. i trying use du , -i option ignore files of given type. resorting -i because os x du doesnt include "exclude" option. essentially trying find os x equivalent command: du -ah --exclude="*.txt" /directory/folder

filemaker - How can I show a specific record near the top in list view without screen flicker? -

i have script (in filemaker 14) sets variable, $_record_number , get ( recordnumber ) based on specific criterion. once it's been set, want bring record top in list view. (it's possible criterion never fulfilled , $_record_number empty.) the portion of script looks following: go record/request/page [ last ] refresh window [] go record/request/page [ no dialog ; max ( $_record_number ; 1 ) ] when refresh window step isn't present, script doesn't work correctly. instead of bringing record top of list view, brings bottom. unfortunately, refresh window step causes window flicker script redraws layout. is there way duplicate end results of above steps without using refresh window , avoid screen redraw? failed techniques i've tried: using refresh object instead of refresh window targeting objects in both header , body using go related record relationship target record if you're using filemaker 13 or higher, can try refresh object ...

ajax - i have used datepicker but it always store date like 1970-01-01 -

can 1 please me? used date picker date , select today stores 1970-01-01 . $("#datepicker-1").datepicker(); }); and in php file stored in database: $dt=$_post['date']; $dt1=date('y-m-d',strtotime($dt)); but stores 1970-01-01 no matter date choose. please me.

javascript - node.js - making result available globally (Request module) -

i'm trying process returned json result request need expand scope outside request call. declared data variable empty string , assign result data doesn't print result. how can accomplish this? module.exports = function(callback) { var request = require("request") var url = "http://sheetsu.com/apis/94dc0db4" var data = ""; request({ url: url, json: true }, function (error, response, body) { if (!error && response.statuscode === 200) { callback(body) data = body; } }) console.log(data); } your script executed in order: request() executed console.log(data) request() callback function, asign data value if want print data , must inside request callback function. async module, useful when performing async tasks, specially if need perform tasks in specific order , use data requests.

JSQMessagesViewController animated typing indicator -

i'm working on project uses jsqmessagesviewcontroller library. has animated typing indicator, , if share approach? thanks! you want jsqtypingindicatorfooterview here documentation. http://cocoadocs.org/docsets/jsqmessagesviewcontroller/7.2.0/classes/jsqmessagestypingindicatorfooterview.html you can set ellipsiscolor messagebubblecolor color of bubble self. shoulddisplayonleft decide if should on left or right. collectionview collection view should show on.

ReactJs - Uncaught TypeError: Cannot read property 'string' of undefined -

my 2 files: app: import react, { component } 'react'; import { nice, super_nice } './colors'; import counter './counter'; export class app extends component { render() { return ( <div> <counter increment={ 1 } color={ nice } /> <counter increment={ 5 } color={ super_nice } /> </div> ); } } counter: import react, { component } 'react'; class counter extends component { constructor(props) { super(props); this.state = { counter: 0 }; this.interval = setinterval(() => this.tick(), 1000); } tick() { this.setstate({ counter: this.state.counter + this.props.increment }); } componentwillunmount() { clearinterval(this.interval); } render() { return ( <h1 style={ { color: this.props.color } }> counter ( { this.props.increment } ): { this.state.counter } </h1> ); } } counter.defaultprops = { i...

string - Using regex to split() -

i've been trying regular expression work code while , wondering if knows better way. i've got big chunk of text parse , want split array based on lines. straightforward, right? using regex: var re:regexp = /\n/; arr = content.split(re); easy. want split on lines not have space after them. figured i'd use \s character match non-space character after \n. var re:regexp = /\n\s/; arr = content.split(re); however, removes first letter of every line i'm splitting (because it's matching letters). what's best way to: ignore spaces using caret (i tried /\n^\' '/ no luck)? not lose \s character when splitting string array? use lookahead in pattern (so \s symbol won't consumed split separator): var re:regexp = /\n(?=\s)/; arr = content.split(re);

html - .htaccess file not working on linux server -

i know there more questions , answers none of them usefull me. i configured website on apache linux server,that i'm managing cpannel.and edited .htaccess file remove html extensions url. after uploaded file manager , nothing changes.what need make work ? i've been searching configuration files set allowoverride all didn't found anything.and don't have etc/apache2/ directory in file manager, there other files in etc/ directory. edit: server info : hosting package:startup2013 server name: wolf cpanel version: 11.50.1 (build 3) theme: paper_lantern apache version: 2.4.16 php version: 5.6.12 mysql version: 5.6.23 architecture: x86_64 operating system: linux shared ip address: 185.81.0.40 path sendmail: /usr/sbin/sendmail path perl: /usr/bin/perl perl version: 5.10.1 kernel version: 2.6.32-573.3.1.el6.x86_64 here .htaccess code : rewriteengine on rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.ht...

r - How can I split a character string in a dataframe into multiple columns -

i'm working dataframe, 1 column of contains values numeric may contain non-numeric entries. split column multiple columns. 1 of new columns should contain numeric portion of original entry , column should contain non-numeric elements. here sample data frame: df <- data.frame(id=1:4,x=c('< 0.1','100','a 2.5', '200')) here data frame like: id x1 x2 1 < 0.1 2 100 3 2.5 4 200 on feature of data taking advantage of structure of character strings follows: non-numeric elements (if exist) precede numeric elements , 2 elements separated space. i can use colsplit reshape package split column based on whitespace. problem replicates entry can't split 2 elements, require(reshape) df <- transform(df, x=colsplit(x,split=" ", names("x1","x2"))) df id x1 x2 1 < 0.1 2 100 100 3 2.5 4 200 200 this not terribly problematic can post-processing remov...

mysql - What is the best optimization for this table and its queries? -

i have table: create table if not exists `listings` ( `id` int(10) unsigned not null auto_increment, `type` tinyint(1) not null default '1', `hash` char(32) not null, `source_id` int(10) unsigned not null, `link` varchar(255) not null, `short_link` varchar(255) not null, `cat_id` mediumint(5) not null, `title` mediumtext not null, `description` mediumtext, `content` mediumtext, `images` mediumtext, `videos` mediumtext, `views` int(10) not null, `comments` int(11) not null default '0', `comments_update` int(11) not null default '0', `editor_id` int(11) not null default '0', `auther_name` varchar(255) default null, `createdby_id` int(10) not null, `createdon` int(20) not null, `editedby_id` int(10) not null, `editedon` int(20) not null, `deleted` tinyint(1) not null, `deletedon` int(20) not null, `deletedby_id` int(10) not null, `deletedfor` varchar(255) not null, `published` tinyint(1) not null def...

ember.js - Ember action : set property of only target of #each -

i have few actions i'm placing on each item in loop. action reveals of book-covers, instead of 1 want target. http://guides.emberjs.com/v2.0.0/templates/actions looks can pass parameter, i'm not sure of syntax. i've done before in earlier version , remember using this or should {{action 'showcover' book}} ... ? controller import ember 'ember'; export default ember.controller.extend( { actions: { showcover(book) { // ? this.set('covervisible', true); // or this.toggleproperty('covervisible'); }, ... } }); other thoughts... actions: { showcover(book) { // setting *route in general* covervisible:true - not want this.set('covervisible', true); // can see class - route... console.log(this); // can see model of route... console.log(this.model); // , can see book object... console.log(book); // how set book object??? //...

priority queue - Using priority_queue in C++ -

i'm trying write simple function returns time wait car arrives @ gate of parking lot. i'm using priority_queue purpose , code doesn't seem compile. here's function std::time_t waitingtime(std::vector<car* > v){ //std::unordered_map<std::time_t, std::string> lookup; std::vector<std::time_t> timevector; std::priority_queue<std::time_t, timevector, std::greater<std::time_t>> q; for(auto = v.begin(); != v.end(); it++){ car* c = *it; timevector.push_back(c->exit); //lookup[c->exit] = c->id; } for(std::time_t t :timevector){ q.push(t); } const std::time_t t = q.top(); q.pop(); return t; }; here's driver code std::time_t = time(0); car* c1 = new car("a", now+2, now+4); car* c2 = new car("a", now, now+3); car* c3 = new car("a", now, now+1); std::vector<car* > v; v.push_back(c1); v.push_back...

eclipse - standalone-full.xml errors - unrecognised jboss properties -

i seeing several errors in standalone-full.xml in maven project in eclipse. following line (one of many) has errors displayed. <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/> error: multiple annotations found @ line: - cvc-attribute.3: value '${jboss.management.http.port:9990}' of attribute 'port' on element 'socket-binding' not valid respect type, 'unsignedshort'. - cvc-datatype-valid.1.2.1: '${jboss.management.http.port:9990}' not valid value 'integer'. i realize because jboss properties not being picked up. "jboss.home" recognized. has seen before? in advance.

php - How to get echo to return equation? -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers i trying create small form adds amounts html form code found below html page--> <html> <head> <meta charset="utf-8"> <meta name="viewport" content ="width=device-width,initial-scale=1,user scalable=yes" /> <title>nmaws form</title> <style type="text/css"> div#container { width: 800px; position: relative; margin-top: 0px; margin-left: auto; margin-right: auto; text-align: left; } </style> <style type="text/css"> body { text-align: center; margin: 0; background-color: #ffffff; color: #000000; } </style> </head> <body> <form method="post" attribute="post" acti...

Grails : how to best construct a hibernate criteria builder to search 'hasMany' relationships with domain instance -

i working on grails project , leverage hibernate criteria builders search instances of domain object. find instances 1 of 'hasmany' relationships contains domain object ids. here example of mean. domain objects class product { static hasmany = [ productoptions: productoption ] } class productoption{ option option static belongsto = [ product: product ] } class option{ string name } this simplified example of domain structure , doesn't include relationships. an option size, color, brand, etc. example of achieve lets have 3 products. product 1 red, small , brandx product 2 blue, small , brandx product 3 yellow, medium , brandz i have few scenarios need cover. scenario 1 find products blue, small , brandx. in case should return product 2. scenario 2 find products either red or blue , size small. both product 1 , product 2 should returned. scenario 3 find products either brandx or brandz. products should returned. ...

java - How can I specify an array as a parameter -

i have following method: public void testmethod() { string id = card.people[4]; id = card.rooms[4]; } string id should either equal card.people[4] or card.rooms[4]. how can specify in parameter id should equal? this general format use: public void testmethod(mytype[] array) { mytype fourthelement = array[4]; }

python - IPython Notebook - python3 not found after uninstalling Anaconda3 for Anaconda -

i uninstalled anaconda 2.3 python 3.4.3 , installed same anaconda version python 2.7.10. when open notebook via $ ipython notebook "example notebook.ipynb" tries use python3 kernel opposed opening installed python2. of course error python3 kernel not found . how can ipython notebooks open python2 kernel? i've tried uninstall ipython , ipython notebook, delete .ipython , .jupyter user directory in case there defaults set in these folders, reinstalled both. still same problem. any appreciated you can install several python versions alongside each other. create environment (replace "all packages" names of packages). conda create --name mypy_27 python = 2.7 or conda create --name mypy_34 python = 3.4 afterwards can activate environments typing source activate mypy_34 if do conda install "all packages" you install desired packages in active environment. you can more .

css - IE gaps when rendering html table cell with radius border nested in other table -

in ie (version 11 , older versions), small vertical and/or horizontal gaps (or lines) in border when using radius on td in nested table. same problem occurs if used radius on div nested in table. if use zoom function in ie, lines appear or display depending on zoom level. there no problem in firefox nor chrome. , using nesting, because need background color near radius different background color of enclosing table. here screenshot of white line error: [![enter image description here][1]][1] here sample code: <table style="width:50%;" cellspacing="0"> <tr> <td style="background-color:#292f6c;"> sadasd </td> </tr> <tr> <td style="background-color: white;padding: 0px;border:0px;"> <table style="border-spacing:0px;width:100%;height: 10px;"> <tr> <td style="background-color:#292f6c;-webkit-border-botto...

r - How do I make timeSeries plot display time in local timezone? -

i'm using timeseries package manipulating , plotting time series. can create timeseries object using gmt times, then, setting fincenter property "newyork" make print times in new york local time zone. plot() function takes fincenter argument, , 1 think setting local times plotted on x axis. doesn't work me, still displays in gmt, no matter do. a <- sys.timedate() + 1:5 # newyork # [1] [2015-09-29 21:54:50] [2015-09-29 21:54:51] [2015-09-29 21:54:52] # [4] [2015-09-29 21:54:53] [2015-09-29 21:54:54] @ <- timeseries(1:5, a) @ # newyork # ts.1 # 2015-09-29 21:54:50 1 # 2015-09-29 21:54:51 2 # 2015-09-29 21:54:52 3 # 2015-09-29 21:54:53 4 # 2015-09-29 21:54:54 5 plot(at) plot(at, fincenter = "newyork") both plot functions render same x axis labels, in gmt. knows how fix it?

javascript - AngularJS Controller Access for all views -

i'm working on angularjs app , attempting create controller functions used throughout app. examples of include button, logout button, , navigation links. when trying execute it, won't work. how able make work. for reference, body starts below controller code: angular.module('squeeg.controllers', []) .controller('squeegapp', function($scope, $state, $rootscope, $stateparams) { $scope.back = function() { $state.go('welcome'); }; $scope.logout = function() { parse.user.logout(); $rootscope.user = null; $rootscope.isloggedin = false; $state.go('welcome', { clear: true }); }; }) .controller('welcomecontroller', function($scope, $state, $rootscope, $stateparams) { alert("test"); }) .controller('homecontroller', function($scope, $state, $rootscope) { $scope.home = "home"; }) .controller('view2', function($scope, $state, $rootscope) { $scope.me...

php - How to display pdf file inside iframe from mysql database -

hello im begginer in php , code igniter im working on project , im having hard time doing it. im trying display pdf file inside iframe,which stored in database here code: controller: $data['data_pdf'] = $this->home_model->pdfmanuscript(); model: public function pdfmanuscript(){ $query = $this->db->query("select * tblscipdf pdf_dateuploaded=( select max(pdf_dateuploaded) tblscipdf featured='1') "); return $query->result_array(); } views: <iframe style="border:1px solid #666ccc" title="pdf in i-frame" src="<?php echo base_url('pdf/').$data_pdf["pdf_name"]; ?>" frameborder="1" scrolling="auto" height="900" width="850" align="middle"> </iframe>

HTTP Post Upload Multiple Files from iOS to PHP -

in ios app, i'm building nsdata use body nsmutableurlrequest can upload multiple files in 1 http post. the contents of post body (with file data removed , replaced byte count): multipart/form-data; charset=utf-8; boundary=0xkhtmlboundary --0xkhtmlboundary content-disposition: form-data; name="email" myemailaddress@gmail.com --0xkhtmlboundary content-disposition: form-data; name="sqlite"; filename="backup.myapp.v1.1.3-to-v1.1.3.1443578420.sqlite" content-type: application/octet-stream // ... data length: 880640 --0xkhtmlboundary-- content-disposition: form-data; name="sqliteshm"; filename="backup.myapp.v1.1.3-to-v1.1.3.1443578420.sqlite-shm" content-type: application/octet-stream // ... data length: 32768 --0xkhtmlboundary-- content-disposition: form-data; name="sqlitewal"; filename="backup.myapp.v1.1.3-to-v1.1.3.1443578420.sqlite-wal" content-type: application/octet-stream // ... data length: 39016...

Remove ordered currency from magento admin -

does know quick way remove ordered currency order summary detail , order mail? having sage pay currency conversion issue. base currency , ordered currency have same value. want remove ordered currency order mail , order details example @ moment on our multi store setup have order summary displaying so: grand total £447.60 [€447.60] here £447.60 value correct conversion euro not correct. want display totals in base currency.

php - Symfony: how to sort One2Many/Many2One of an entity? -

i've 3 entities: product , productpicture , picture . i'd sort pictures it's position , tried this , code below. result : it's not sorting joined pictures position. it's sorting products pictures' position. i'm confused. far can see, followed docs, weird result. cache cleared. any ideas? in advance! entity: product // ... class product { /** * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue */ protected $id; /** * @orm\onetomany(targetentity="productpicture", mappedby="product") * @orm\orderby({"position" = "desc"}) // <------ !!! */ protected $pictures; // ... } entity: productpicture // ... class productpicture { /** * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue */ protected $id; /** * @orm\column(type=...

json - Libcurl C++ Convert std::string to cv::Mat object -

i have c++ implementation uses libcurl pull down json object contains image in byte[ ]. need convert mat object can process using opencv. string extract json value prints out appears valid byte array. same printing vector. every method have tried convert mat object results int following error. appreciated. error: opencv error: assertion failed (size.width>0 && size.height>0) in imshow, file /users/misanthropic/opencv-3.0.0/modules/highgui/src/window.cpp, line 271 libc++abi.dylib: terminating uncaught exception of type cv::exception: /users/misanthropic/opencv-3.0.0/modules/highgui/src/window.cpp:271: error: (-215) size.width>0 && size.height>0 in function imshow code: curl *curl; curlcode res; const cv::_inputarray data; std::string readbuffer; char *url = "http://ezquote-server.herokuapp.com/requestimagefile"; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, curlopt_url, url); curl_easy_setopt(curl, curlopt_writefunctio...

javascript - Associative array to String and String to associative array -

i have convert an associative array string in php . doing as $cookievalue = http_build_query(arr,'','sep'); and setting cookie using setcookie . setcookie('subs',$cookievalue,0,'/'); cookie in js side looks like "emailid=a1%40a.comsepmaths=0sepphysics=1sepchemistry=2sepbotany=3sepzoology=4se ptamil=5sepenglish=6seppolity=7sepgk=8sephistory=9" i trying convert associative array. i tried json.parse . it's not useful in case. i free change both php side , js side functions . aim should easy convert forth , back. i tried implode on php also. try this: var = "emailid=a1%40a.comsepmaths=0sepphysics=1sepchemistry=2sepbotany=3sepzoology=4septamil=5sepenglish=6seppolity=7sepgk=8sephistory=9"; var myarr = {}; var sep = "sep"; a.split(sep).foreach(function(item){ var sepp = item.indexof("="); myarr[item.substr(0,sepp)] = decodeuricomponent(item.substr(sepp+1)); }); co...

python 3.x - Global variable as a parameter in a function and not being modified in that function -

so guys have following problem need global variable modified in function in next cycle can go further in range need to def down(turtlen,posx,posy,up): #function needs modify global variables move = random.randint(0,1) if move == 1: #goes down left posx += 1 posy += 1 turtlen.goto(listpos[up][posx][posy]) else: #goes down right if posy == 0: #keep in range of list posx += 1 posy = 0 turtlen.goto(listpos[up][posx][posy]) else: posx += 1 posy -= 1 turtlen.goto(listpos[up][posx][posy]) def movimiento(n): global posx1 global posy1 global peso1 posx1 = 0 posy1 = 0 peso1 = 0 k in range(n): down(turtle1,posx1,posy1,0) if want variables global, why use them arguments of function? remove them arguments , declare rather global variable global statement (as in other function).

syntax - Scheme: What type is read? -

when read user input console in scheme, type need use if i'm converting type want? for example (string->number "20") converts string number, syntax regarding read? for example (define input(read) (let ((r read)) (????->number r))) if @ racket documentation read see signature : (read [in]) → any . so in case if user inputs number return number. explicitly check number because can't sure user won't input else! an example : (define (read-number) (let ((inpt (read))) (if (number? inpt) inpt (begin (display "please input number!") (newline) (read-number))))) edit : if want test if inputted number zero, should replace if -statement conditional. (cond ((and (number? inpt) (= inpt 0)) ; works because of lazy evalutation ; user inputted 0 ...) ((number? inpt) ; user inputted number other 0 ...) (else ...

Is it possible/wise to NOT link any pages from index? (SEO, Search Engines) -

i have humble question :) i plan set rather unusual webproject thousand pages, there won't classical navigation (only page , contact) , pages won't link 1 , another. its index > opens random page > opens random page > opens random page.. via small php action.. i know basic seo understanding, should generate static directory sitemap, links pages, google finds pages index downwards.. but don't want users, see it.. kills fun on using site, when can see content pages @ glance.. project exploring random things.. is somehow possible? have dead end index page , thousand dead end html pages connected via php script? thanks in advance.. from technical standpoint, there no issues in planning. seo indexing , google standpoint, make sure none of pages want discovered , indexed google orphans, i.e. without link these pages. these "hidden" pages need not linked home page or sitemap (one-to-many), instead can try breadcrumb method page leads n...

javascript - Three.js - How to create smoke with Three.js? -

Image
i want create brown smoke blowing in sky. how can create this? the shaderparticleengine received rewrite three.js-r72 heavy api changes, updating answer. see answers history comparison and/or settings shaderparticleengine 0.8 / three.js-r71 . allows user fine tune more parameters, create beautiful twisted smoke: example settings emitter in screenshot: var loader = new three.textureloader(); var url = 'assets/images/particles/cloudsml.png'; var texture = loader.load( url ); var particlegroupcrash = new spe.group({ texture: { value: texture }, blending: three.normalblending }); var crashemitter = new spe.emitter({ maxage: { value: 12 }, position: { value: new three.vector3( 0, 0, 0 ), spread: new three.vector3( 1, 0.5, 2 ), }, size: { value: [ 2, 8 ], spread: [ 0, 1, 2 ] }, acceleration: { value: new three.vector3( 0, 0, 0 ), }, rotation: { axis: new t...

spring integration - Setting connection-factory field dynamically in jms outbound adapter -

is possible set connection-factory field dynamically in jms outbound adapter . i thinking of passing connection object in header , use expression way can destination-expression . destination-expression="headers.destinationqueuename" i not find in spring integration's online documentation . no; not possible; see this sample how send messages dynamic servers. it's ftp, same characteristics apply.

VB.net COMExeption was unhandled -

i creating user login system using vb.net , ms access. unsure going wrong system , receive error message "item cannot found in collection corresponding requested name or ordinal" error coming in section "user.find(username)" on first line of loop. here code: public class login dim loginerror string ' tell user wrong login public function login() dim dbconn new adodb.connection ' how tell visual studio 'how connect our database dim user new adodb.recordset 'we pass our argument through our recordset dim username string 'this our "query" dim struserdb string 'this sets email field in our database. dim strpassdb string 'same above password dim blnuserfound boolean 'i using "do" loop use 'this condition dbconn.open("provider = microsoft.jet.oledb.4.0;" & _ "data source = '" & application.startuppath & "\user...

c - Linux Command to Show Stopped and Running processes? -

i'm presently executing following linux command in 1 of c programs display processes running. there anyway can modify show stopped processes , running ones? char *const parmlist[] = {"ps","-o","pid,ppid,time","-g","-r",groupprocessid,null}; execvp("/bin/ps", parmlist); ps -e lists processes. jobs list processes stopped or in background. so, can run jobs command using execvp : char *arg = {"jobs", null}; execvp(arg[0], arg);

javascript - Amcharts - HTML tags in some Labels -

Image
i use following chart: http://www.amcharts.com/demos/stacked-bar-chart-with-negative-values/#theme-none now want add html tags labels. (not all.) example: (here wanna use strong) "dataprovider": [{ "age": "<strong>85+</strong>", "male": -0.1, "female": 0.3 }, { "age": "80-54", "male": -0.2, "female": 0.3 }, ..... ], result: the category axis labels in amcharts svg nodes , therefore not support html tags. what can target specific labels using css. to that, first need enable application of css classess chart elements, setting "addclassnames": true . then target labels using css. each category axis label has class "amcharts-axis-label" set. can target first 1 using css's nth-child selector: .amcharts-category-axis .amcharts-axis-label:nth-child(1) tspan { font-weight: bold; } (i used .amcharts-category-...

javascript - Cordova js return wrong date time and utc on Android only on specific device -

cordova js code return wrong datetime , utc on android, on specific device (sony xperia e6553). mobile time showing correctly, app showing wrong on particular mobile only. checked date & time auto network time, auto time zone settings correct. code var d = new date(); var n = d.toutcstring(); returns wrongly : tue, 29 sep 2015 09:25:28 gmt but in other mobile showing correct value : tue, 29 sep 2015 17:55:28 gmt try using cordova globalization plugin see if helps. cordova plugin add cordova-plugin-globalization

android - MediaPlayer onCompleteListener doesn't trigger on background app in service -

i have implemented mediaplayer in service play files while in background. starting foregroundnotification achieve this. problem i've encountered when song finishing oncompletelistener method not triggering how should, when in app triggers. public class playerservice extends service implements mediaplayer.onpreparedlistener, mediaplayer.onerrorlistener, mediaplayer.oncompletionlistener, mediaplayer.onbufferingupdatelistener{ private static final string action_play = "action.play"; private static final string action_pause = "action.pause"; private static final string action_resume = "action.resume"; private static final string action_seek = "action.seek_to"; private static final string action_next = "action.next"; private static final string action_previous = "action.previous"; private static final string action_repeat = "action.repeat"; private mediaplayer ...

python - Flask app.before_request is not working when it moved to other module -

i'm learning flask these days. at first, wrote whole codes in main.py , , started split codes code increase. everything ok. @app.before_request worked when in main.py , stopped working after move code separate module. i spent many hours catch reason, imagined yet. :( main.py here app = flask(__name__) app.config.from_object(settings) db = sqlalchemy() @app.before_request def working(): user.models import user print '### called in main ###' g.user = user.get_by_session() if __name__ == '__main__': db.init_app(app) app.register_blueprint(frontend.views.blueprint) app.register_blueprint(user.views.blueprint) import frontend.helpers app.run() and frontend/helpers.py from flask import g main import app user.models import user @app.before_request def not_working(): print '### called in frontend.helpers ###' g.user = user.get_by_session() the result shows @app.before_request in frontend/helpers.py ...

php - Destructor method for static instance variable? -

this class: class mysqldb extends pdo{ private $_connection; private static $_instance; //the single instance private $_host = mysql_server_name; private $_username = mysql_server_username; private $_password = mysql_server_password; private $_database = mysql_server_dbname; /* instance of mysqldb @return instance */ public static function getinstance() { if(!self::$_instance) { // if no instance make 1 self::$_instance = new self(); } return self::$_instance; } // pdo mysql connection public function getconnection() { return $this->_connection; } public function __construct(){ try { $this->_connection = new pdo("mysql:host={$this->_host};dbname={$this->_database};charset=utf8", $this->_username, $this->_password); ...

vba - Message when a cell (List values) value is changed -

i relatively new vba. i have table range(e16:dw39) , each cell has dropdown menu (data validation = list) pick value manually @ same time have macro copy data worksheet (two ways populate table). i want message every time user changes cell value manually . i want able still run macro (as noticed cannot after adding following code) independently. intersect check want manual data input. in order check have following code (in specific sheet): private sub worksheet_change(byval target range) ------------------------------------------------------ dim myrange range myrange = range("e16:dw39") '-> mission mix table if intersect(myrange, target) msgbox "mission plan not matching change" end if end sub ------------------------------------------------ i following error run-time error 91: object variable or block variable not set when tried change cell value 1 dropdown menu, above error, idea how solve problem? please notice due code cann...

Lenskit documentation -

i'm trying hang of lenskit (quite hard @ first). right i'm playing around hello-lenskit examples, working expected. however, i'd go beyond , when read documentation seems it's not date, e.g., http://lenskit.org/documentation/basics/configuration/ (many links, such 1 lenskitrecommenderenginefactory , itemitemratingpredictor lead page not found ) so, how did experts master lenskit? trial , error? mailing list? here? cheers!!

Apache Spark - accessing internal data on RDDs? -

i started doing amp-camp 5 exercises . tried following 2 scenarios: scenario #1 val pagecounts = sc.textfile("data/pagecounts") pagecounts.checkpoint pagecounts.count scenario #2 val pagecounts = sc.textfile("data/pagecounts") pagecounts.count the total time show in spark shell application ui different both scenarios. scenario #1 took 0.5 seconds, while scenario #2 took 0.2 s in scenario #1, checkpoint command nothing, it's neither transformation nor action. it's saying once rdd materializes after action, go ahead , save disk. missing here? questions: i understand scenario #1 taking more time, because rdd check-pointed (written disk). there way can know time taken checkpoint, total time? spark shell application ui shows following - scheduler delay, task deserialization time, gc time, result serialization time, getting result time. but, doesn't show breakdown checkpointing. is there way access above metrics e.g. schedule...