Posts

javascript - How to bind ViewModel Store to View? -

i'm pretty new ext js , trying embed multiselect inside panel . the viewmodel has stores property can see here: ext.define('test.view.controls.search.searchfiltermodel', { extend: 'ext.app.viewmodel', alias: 'viewmodel.filter', data: { title: '' }, stores: { test: { fields: [ 'id', 'name' ], proxy: { type: 'ajax', url: 'api/test', reader: 'array' }, autoload: true } } }); i bind in view this: viewmodel: { type: 'filter' }, layout: 'fit', border: 1, plain: true, scrollable: 'y', layout: 'fit', bind: { title: '{title}', }, items: { xtype: 'multiselect', scrollable: false, allowblank: true, ddreorder: true, bind: { store: '{test}' }, valuefield: 'id', displayfield: 'name' } ...

Sort a complex associative array in PHP -

this question has answer here: php sort array subarray value 5 answers i have associative array in php like: $newarray1 = array ( [producta] => array ( [link] => http://sanjosespartan.com/blog/products/agile-java-development/ [visitcount] => 4 ) [productd] => array ( [link] => http://sanjosespartan.com/blog/products/intro-to-go/ [visitcount] => 1 ) [productg] => array ( [link] => http://sanjosespartan.com/blog/products/node-js-for-developers/ [visitcount] => 1 ) [productb] => array ( [link] => http://sanjosespartan.com/blog/products/beginning-mysql/ [visitcount] => 1 ) [productc] => array ( [link] => http://sanjosespartan.com/blog/products/computer-networks/ [visitcount] => 1 ) ...

OSX App: Get max resolution of the user's display (Swift) -

i'm trying max resolution of user's display-- not current resolution, maximum display supports. know can current resolution this need maximum (ie: on mbp 13inch resolution 2560x1600). i know can in terminal using this , avoid trying hack-y in terminal, , instead swift. suggestions on how can this? thanks. you need use quartz display services. first, list of displays, cggetactivedisplaylist . then, each display, use cgdisplaycopyalldisplaymodes . iterate on array of modes, using cgdisplaymodegetwidth , cgdisplaymodegetheight figure out highest resolution.

ios - Can someone show me a more efficient way to handle multiple text field delegates? -

i'm working on project user have 5 text fields input data. "calculate" button calculates required computations based on user input. solution create 5 iboutlet uitextfields , connect them in xib file. each text field handle events based on input following code. can show me efficient way solve problem? - (bool)textfieldshouldreturn:(uitextfield *)textfield{ if(textfield == self.numberofnightstf){ self.numberofnights = [self.numberofnightstf.text intvalue]; nslog(@"the number of nights set %.d days", self.numberofnights); } else if(textfield == self.nightlychargetf){ self.nightchargecost = [self.nightlychargetf.text floatvalue]; nslog(@"the cost of charge per night set %.2f$", self.nightchargecost); } else if(textfield == self.roomservicetf){ self.roomservicecost = [self.roomservicetf.text floatvalue]; nslog(@"the additional room service cost set %.2f$", self.roomservicecost); } else if(textfield == self.telep...

php - Best way to save orders in array by date -

my database is: table: orders, columns: id (int), order_status(varchar), time (timestamp), price (decimal); i want receive sum of orders prices each day in 1 array. best way that? i've used this, lasts 24h, 48h, 72h... orders , not each day (from 00:00 until 23:59). $timeback = time() - 86400; $time = time(); $month = array(); for($i = 0; $i < 30; $i++){ //query example $month[$i] = select orders `order_status` = 'completed' , `time` between {$timeback} , {$time} order `id` asc"); $timeback = $timeback - 86400; $time = $time - 86400; }

python - Selenium action chains to click inside silverlight plugin object in a page -

currently trying click button inside of silverlight web app, , yes know beforehand silverlight not supported think @ least worth try action chain module. here best come until now: profile = firefoxprofile() profile.set_preference('plugin.default.state', 2) driver = webdriver.firefox(profile) driver.get('http://www.trypython.org') time.sleep(8) sldiv = driver.find_element_by_xpath('//*[@id="silverlightcontrolhost"]') builder = actionchains(driver) builder.move_to_element_with_offset(sldiv, 372, 44) builder.click() it not clicking, or @ least not in expected coordinates (where button is). away this? if so, able type text after clicking inside textbox? do not mention silverlight-selenium outdated project

c# - How can I set a max. ExpirationDate TimeSpan on a azure Media Service Locator? -

i mistakenly set wrong time several locator url's connected uploaded videos. trying correct setting locator maxvalue ensure not go away, several others have already. tried following, context.locators.create(locatortype.ondemandorigin, outputasset, accesspermissions.read, timespan.maxvalue), , resulted in "the added or subtracted value results in un-representable datetime". maximum timespan can possibly set if not want locators expire? you set 100 years expiryon time, should sufficient.

python - How can I make the value of a user's input into a variable with a usable value? -

from turtle import* branch_width=4 grass_color=input("would grass snowy, dead, or healthy? ") sky_color=input("would morning, afternoon, or evening? ") morning="cadetblue" afternoon="cornflowerblue" evening="royalblue" snowy="snow" dead="wheat" healthy="darkgreen" every time try use input color(sky_color) , user's input not translated morning="cadetblue" , etc, returns error. how fix this? need make user type in color? you have confused variable names , character strings. set variable called morning string "cadetblue". has nothing input string "morning". you have set explicitly. a dictionary here: interpret_color = { "morning": "cadetblue", "afternoon": "cornflowerblue", "evening": "royalblue", "snowy": "snow", "dead": "wheat", ...

jquery - Split input name attribute in nested rails form with javascript -

first off, having trouble describing issue. apologize in advanced if not seeing existing answer online. how can split string array each entry text within each set of square brackets. here string: plan_year[benefit_groups_attributes][0][relationship_benefits_attributes][1][premium_pct] what need store value in second set of square brackets. in example [0]. .split hasn't given me result wanted, , think because doing .split(/[[]]/); should expect work? var s = 'plan_year[benefit_groups_attributes][0][relationship_benefits_attributes][1][premium_pct]'; s.match(/\[.*?\]/g)[1]; # "[0]"

linux - Is there a way to use perf tracepoints without running as root? -

summary: i want able profile event sched:sched_stat_sleep without running root. possible? details: when run command: sudo perf stat -e sched:sched_stat_sleep sleep 1 output looks correct: performance counter stats 'sleep 1': 1,001,729,231 sched:sched_stat_sleep 1.002880455 seconds time elapsed but when run without sudo error invalid or unsupported event: 'sched:sched_stat_sleep' run 'perf list' list of valid events usage: perf stat [<options>] [<command>] -e, --event <event> event selector. use 'perf list' list available events and when run perf list without sudo part of output is: [ tracepoints not available: permission denied ] i found anther question suggests setting kernel.perf_event_paranoid -1 . tried doing doesn't appear make difference. did not reboot after making change (is necessary?). viewing setting seems indicate it's set -1...

jquery - Two BackboneJS fetches and data gets swapped -

this our code inside single function. i'm beginning better backbonejs. // let's pull desktop data this.desktop = new desktopitemmodel({device: 'desktop'}); this.desktoppromise = this.desktop.fetch(); // let's pull mobile data this.mobile = new mobileitemmodel({device: 'mobile'}); this.mobilepromise = this.mobile.fetch(); // i'm not sure if previous developer trying implement similar $q.all this.allpromise = [desktoppromise, mobilepromise]; $.when(this.desktoppromise).done(_.bind(function() { // desktop stuff }, this)); $.when(this.mobilepromise).done(_.bind(function() { // mobile stuff }, this)); if (this.allpromise) { $.when.apply($, this.allpromise).done(_.bind(function() { // stuff here if desktop .... // stuff here if mobile .... }, this)); } i noticed there times our data in our variable gets mixed between desktop , mobile. response api server fine. suspected api team returning wrong data until debugged our app,...

SICP "streams as signals" in Python -

i have found nice examples ( here , here ) of implementing sicp-like streams in python. still not sure how handle example integral found in sicp 3.5.3 " streams signals ." the scheme code found there is (define (integral integrand initial-value dt) (define int (cons-stream initial-value (add-streams (scale-stream integrand dt) int))) int) what tricky 1 returned stream int defined in terms of (i.e., stream int used in definition of stream int ). i believe python have expressive , succinct... not sure how. question is, analogous stream-y construct in python? (what mean stream subject of 3.5 in sicp, briefly, construct (like python generator) returns successive elements of sequence of indefinite length, , can combined , processed operations such add-streams , scale-stream respect streams' lazy character.) there 2 ways read question. first simply: how use stream constructs, perhaps ones second ...

c# - Credentials passed from client to WCF do not make it there -

im trying pass windows credentials wcf service requires windows authentication seems credentials not making service. service not throw errors when check either of 2 below empty. var user = windowsidentity.getcurrent().user; var callerusername = servicesecuritycontext.current.windowsidentity.user; here client side code servicereference1.dispatchserviceclient service = new dispatchserviceclient(); service.clientcredentials.windows.clientcredential = servicecredentialsmanager.getnetworkcredentials(); service.clientcredentials.username.username= servicecredentialsmanager.getnetworkcredentials().username; service.clientcredentials.username.password = servicecredentialsmanager.getnetworkcredentials().password; client config - <basichttpbinding> <binding name="basichttpsbinding_idispatchservice"> <security mode="transport"> <transport clientcredentialtype="windows" /> </security> <...

c - Generate proper output for student id and score and find max and min? -

i'm working through programming in c book , part added hw, i'm not sure how display these quite code comments suggest. below comments in output() , used statement printf("%d\t%d\n", students.id, students.score); i'm not getting id , score correctly. i'm not sure about. it's getting generated , later printed in main, not quite how it's supposed to. then i'm not sure how find minimum, max , avg scores in summary() because randomly generated. @ students[i].id , students[i].score ? #include <stdio.h> #include <stdlib.h> #include <math.h> #include <conio.h> #include <assert.h> struct student{ int id; int score; }; struct student* allocate(){ /*allocate memory ten students*/ struct student* s = malloc(10 * sizeof(struct student)); assert (s != 0); /*return pointer*/ return s; } void generate(struct student* students){ /*generate random id , scores 10 students, id being between 1 ...

linux - Convert list of FQDN and IPs to two column CSV -

i'd take list this: example.com 1.2.3.4 ftp.example.com 2.3.4.5 3.4.5.6 www.example.com 4.5.6.7 5.6.7.8 6.7.8.9 and parse comma delimited csv format when opened in popular spreadsheet program, parent fqdns in column , children ips in column b. i'd using native linux binaries can bake existing bash script. any welcome, , in advance. this might work (gnu sed): sed -r '/[[:alpha:]]/h;//d;g;s/(.*)\n(.*)/\2,\1/' file if line contains alphabetic characters i.e. address, store in hold space , delete it. otherwise, append address current line , swap 2 fields replacing newline , , print.

hadoop - Which version of Spark to download? -

i understand can download spark source code (1.5.1), or prebuilt binaries various versions of hadoop. of oct 2015, spark webpage http://spark.apache.org/downloads.html has prebuilt binaries against hadoop 2.6+, 2.4+, 2.3, , 1.x. i'm not sure version download. i want run spark cluster in standalone mode using aws machines. <edit> i running 24/7 streaming process. data coming kafka stream. thought using spark-ec2, since have persistent ec2 machines, thought might use them. my understanding since persistent workers need perform checkpoint() , needs have access kind of shared file system master node. s3 seems logical choice. </edit> this means need access s3, not hdfs. not have hadoop installed. i got pre-built spark hadoop 2.6. can run in local mode, such wordcount example. however, whenever start up, message warn nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable is problem? need hadoop? <edi...

javascript - Function wont call inside a jquery .click() -

trying call function inside .click event. know .click working because of console.log. not sure why function wont work. have tried other solutions such onclick() in html no luck. here links clicked on: <h2 class="logo child"></h2> <ul> <li><a href="#web" class="nav-link">developer</a></li> <li><a href="#design" class="nav-link">designer</a></li> <li><a href="#film" class="nav-link">film</a></li> <li><a href="#portfolio" class="nav-link">portfolio</a></li> <li><a href="#about" class="nav-link">about</a></li> </ul> here javascript $(document).ready(function(){ function spinlogo() { $('.logo').css({ 'transition' : '1.5s ease-in-out', 'tran...

objective c - Swizzling have to be on main thread? -

i succesfully swizziling imagenamed: method when on main thread. here code, js-ctypes: https://gist.github.com/noitidart/e8105a5f702dc9e6a4b8 i seem crashing when doing thread. i'm not sure if it's typo somwhere, i'm still digging can't seem find mistakes. wondering if swizziling method_setimplementation not thread safe? does same thread safety apply swizziling method_exchangeimplementations ? i think have issue in code can recommend jrswizzle library https://github.com/rentzsch/jrswizzle , demo how use: https://github.com/kostiakoval/jrswizzleexample

How do I edit Sql Templates in VS 2013? -

the original question here based on misunderstanding, i'm modifying (there no answers original question). in previous versions of visual studio item templates sql items seemed move version version. having difficult time finding had been placed in vs 2013. default template t-sql stored procedures produces following (and wanted modify): create procedure [dbo].[stored_procedure_name] @param1 int = 0, @param2 int select @param1, @param2 return 0 i want modify extensive according our standard in shop. couldn't figure out had put templates time. so they? after asking around shop developer of acquaintance found templates me. located here: c:\program files (x86)\microsoft visual studio 12.0\common7\ide\extensions\microsoft\sqldb\extensions\sqlserver\items mystery solved.

javascript - Empty object minus/plus empty object, and reverse value -

i have question. in console i'm training "arithmetics", like: false + true // 1 so, question is, why: [] - {} // nan and {} - [] // -0 can explain this, because both of them types object. , know javascript have , falsy values. so, if take boolean({}) // true boolean([]) // true in both have true , think result like: true + true // 2 or true - true // 0 in context (in console), {} empty block nothing, result same - [] and [] coerce 0, seen by: +[] if want {} treated empty object, try this: ({}) - [] you nan now, since empty object not coerce number. update: work should expect in console (returning nan): ({} - [])