Posts

Showing posts from April, 2015

android - Glide caching off screen images in memory -

i want load , cache images in memory , not pass them view , later on when need them loaded on ui them memory cache if existed in memory. i tried: glide.with().load(uri).into(new simpletarget<glidedrawable>(width,height) { @override public void onresourceready(glidedrawable resource, glideanimation<? super glidedrawable> glideanimation) { //left empty } } ); but when later on make call load uri in imageview still load path , not memory. is there way have images cached in memory without loading them on ui? documentation on how cache images on background thread can found here . here example code page showing how file downloaded cache, without displaying image in ui: futuretarget<file> future = glide.with(applicationcontext) .load(yoururl) .downloadonly(500, 500); // can omitted if want have data cached (same goes "future" instance variable file cachefile = future.get(); however, make sure have configured glide su

javascript - Dojo charting - rightmost axis title getting cut in half -

i using dojo create bar chart multiple vertical axes (one actual count, other percentage), , when do, title right axis gets cut off (i.e., half of that's furthest chart gets cut off edge of chart). i've tried using chart.resize(w,h) , shrinks data in chart, while maintaining same margins edge (and same title cut before). know how title display? reference, here's code i'm using, both create div node , chart. chartnode = domconstruct.create("div", { id : this.context.viewid + "_chartnode", }, this.context.element, "first"); domstyle.set(chartnode, { width : "800px", height : "400px" }); var chart = new chart(chartnode); chart.addplot("default", { type : "columns", markers : true, gap : 5 }); chart.addplot("something", { type : "columns", vaxis : "percent" }); chart.addaxis("x", { title : "person", titleor

python - Is it possible to combine multiple partially fit estimators in sklearn? -

i have lot of data , want parallelize estimator fitting splitting data , fitting multiple estimators running in multiple threads, or multiple machines. some estimators provide partial_fit api out-of-core learning (e.g. passiveaggressiveclassifier here ) is possible have multiple estimators fit partially, , combine individual fits single estimator? not using standard api. can average coef_ , intercept_ , produce meaningful estimator. want parallelize on 1 core or on network? there might more efficient options you, of require little more work. there parallel implementations of sgd, these pay of huge data sets. how large data (number of samples, number of features, sparsity)?

ios - JSON Object Mapping - RestKit -

i have below json response. how can object mapping it? using ios - restkit. { "predictions":[ { "description":"user1", "id":"75b8c57b4443f4b881f0efc94afd52437232aee9" }, { "description":"user2", "id":"82aa3303704041cda0e4fc34024d383dbf923604" }, { "description":"user3", "id":"f88f669a30934ef599bccf86c0236426cf2d313e" }, { "description":"user4", "id":"fa9ae7b65fa52bffdabf00d69e7db5cd37539781" }, { "description":"user5", "id":“66df3fd7e400eb31efd3ac935036aab2c02b03f0" } ], "status":"ok" } create new class called prediction description , predictionid properties , use mapper ob

python - What's faster: to reorder a list of lists or to reorder a list of indexes? -

what faster: reorder list of lists or reorder list of integers? should first represent main list list of indexes (to represent list of ordinal type) of inner lists or can work directly list of lists? from test, can see take same amount of time: a = range(100) b = [range(10) _ in range(100)] if __name__ == '__main__': timeit import repeat n = 500 r = 5 print min(repeat('shuffle(a)', setup='from random import shuffle;from __main__ import a', repeat=r, number=n)) print min(repeat('shuffle(b)', setup='from random import shuffle;from __main__ import b', repeat=r, number=n)) i noticed slight speed advantage reordering list of ints, it's neither significant, nor consistent enough warrant using list of indices. sometimes, reordering lists of lists faster , vice versa. this because objects binded reference values stored , passed around variables, , everything object in python, int types. "reordering l

java - get "app:preDexDebug" error when adding a specific jar -

recently i'm trying use android studio instead of eclipse , there 1 thing can not solve. when i'm trying import following class jar gives following error the class: import java.io.ioexception; import java.util.hashmap; import java.util.iterator; import java.util.list; import com.google.api.client.googleapis.json.googlejsonresponseexception; import com.google.api.client.http.httprequest; import com.google.api.client.http.httprequestinitializer; import com.google.api.services.youtube.youtube; import com.google.api.services.youtube.model.resourceid; import com.google.api.services.youtube.model.searchlistresponse; import com.google.api.services.youtube.model.searchresult; public class search { private static final long number_of_videos_returned = 25; private static youtube youtube; public static void main(string args[]){ } public static hashmap<string, string> search(string queryterm, string apikey) { try { youtube = new y

Error Starting MobileFirst Platform Operational Analytics for WebSphere Application Server Liberty -

i installing mobilefirst platform operational analytics on websphere application server liberty 8.5.5.1 per this guide . start server gives me message on console: info ] srve0169i: loading web module: analytics. [info ] srve0250i: web module analytics has been bound default_host. [audit ] cwwkt0016i: web application available (default_host): http://hqdvwkl001:9080/analytics/ [info ] sesn0176i: new session context created application key default_host/analytics [info ] sesn0172i: session manager using java default securerandom implementation session id generation. [info ] ffdc1015i: ffdc incident has been created: "java.lang.noclassdeffounderror: org/slf4j/loggerfactory com.ibm.ws.webcontainer.osgi.virtualhost startwebapp" @ ffdc_15.04.09_13.28.41.0.log [info ] ffdc1015i: ffdc incident has been created: "com.ibm.ws.container.service.state.statechangeexception: startwebapplication com.ibm.ws.webcontainer.osgi.webcontainer startmodule" @ ffdc_1

Aggregate separate Flume streams in Spark -

i researching ability "realtime" logprocessing in our setup , have question on how proceed. so current setup (or intend it) follow: server generates logfiles through rsyslog folder per customer. server b generates logfiles through rsyslog folder per customer. both server , b generate 15 logfiles (1 per customer) in folder per customer, structure looks this: /var/log/customer/logfile.log on server c have flume sink running listens rsyslog tcp messages server , server b. testing have 1 flume sink 1 customer, think need 1 flume sink per customer. this flume sink forwards these loglines spark application should aggregate results per customer. now question is: how can make sure spark (streaming) aggregate results per customer? let's each customer have it's own flume sink, how can make sure spark aggregates each flume stream separately , doesn't mix 2 or more flume streams together? or kafka more suitable kind of scenario? any insights appreciat

html - Personalized/random URLs in Python/Django -

i'm python beginner (and english language beginner too, way). created simple form in python/django creates, edit , remove items. have html links refers urls like: file.html: <input type="button" value="edit" onclick="window.location.href='/edit/{{ object.id }}/'"> urls.py: url(r'^edit/(?p<id>\d+)/$', 'app.views.editobj'), views.py: def editobj(request, id): but of course, there's problem, wouldn't people go direct on url (only if button clicked) because type on url: /removeobj/1 , remove object id=1. create differente urls, maybe random, user never guess url button open, , of course, work id argument, when it's goind edit/remove, opens right object. i'm hoping clear on needs. thanks. generating random url's highly inefficient, not mention unnecessarily difficult implement. common way asking post url. think should little more reading on django posting, better understandin

c++ - What's the differences between these two methods of dynamically expanding an array? -

these 2 methods trying dynamically expand array when needed. method 1. int size = 10; int count = 0; int number; int* intlist = new int[size]; in >> number; while (!in.fail()) { if (count == size) { size *= 2; int* temp = new int[size]; (int = 0; < count; i++) { temp[i] = intlist[i]; } delete[] intlist; intlist = temp; } intlist[count] = number; count++; in >> number; } method 2 int size = 10; int count = 0; int number; int* intlist = new int[size]; in >> number; while(!cin.fail()) { if ( count == size ) { int* temp = intlist; intlist = new int[size*2]; ( int i=0;i<size; i++) intlist[i] = temp[i]; delete [] temp; size = size * 2; temp = null; } intlist[count] = number; count++; in >> number; } what happens array temp after method 1 done? necessary free memory of

javascript - Run Bluebird Promises Sequentially, without return values? -

this question has been asked in variety of ways, not quite simply. how promise.all rewritten promise1 runs before promise2 ? var promise1 = function() { .. lots of promise stuff }; var promise2 = function() { .. lots more promise stuff }; promise.all([promise1, promise2]).then(function() { log.info("ran promise1 & promise2"); }); promise.all runs promise1 & promise2 in parallel. you can use promise.map concurrency option set 1. var promise1 = function () { return new promise(function (resolve, reject) { console.log("promise1 pending"); settimeout(function () { console.log("promise1 fulfilled"); resolve(); }, 1000) }) }; var promise2 = function () { return new promise(function (resolve, reject) { console.log("promise2 pending"); settimeout(function () { console.log("promise2 fulfilled");

c# - Hardware back button in WP8.1 universal app -

the question windows phone 8.1 universal app, not blank app template other templates have navigationhelper class in common folder. possible navigate page regardless of navigation history page using hardware button? example if navigation goes page1 page2 > page3 > page2 , page3 navigation hardware button page3 page2 > page3 > page2 , page1. possible manage programaticaly hardware button navigates page2 page1 regardless of navigation history? because, hardware button navigates through pages , in case navigate page3 page2 , page1. trying achieve here when user uses hardware button on page2 want user page1. used appbarbuttons page navigation following code: frame.navigate(typeof(page2)); thanks in advance in wp, must avoid circular navigation, shouldn't go page3 page2, try frame.goback(); to go page2 after page3 or, can manage manually overriding backpressed event, check type of current page, want , set this.handled = true more info : http://

Why do we still use element ID's in HTML if classes are more flexible and do the same thing? -

lets assume making brand new app. make view/template/css/js like, there nothing pre-defined, there no structure. can use whatever selector desire, including classes/data-attribs, in helper libs. so question: what purpose of using id's when classes/data-attribs more flexible, reusable, , easier "stack"? assuming building scratch, have concise reason element id absolutely needed? why still insist on using them in code? i see no point whatsoever using id.... ever . quite frankly cause validators yell @ misusing them. maybe i'm missing golden egg , enlighten me why still use element id's in our apps , things. id less flexible class . that's advantage, not failing. when give id rather class , can rely on being unique , unambiguous (if document valid). if refer element in css or javascript, know you're going single element. because of this, there lots of functions , frameworks rely on id (as comments on question indicate). there's

c# - Dropzone with some other parameters -

i upload image using dropzone.i need send other values via that(some text values).in scenario need send product name controller(pls see comment in code) image comes controller's side,when buttton click. html code <input type="text" name="text" id="txtprod" class="form-control" /> <div id="dropzonffe" style="width: 55%; margin-left: 25%"> <form action="~/admin/saveproducts" class="dropzone" id="dropzonejsform"></form> </div> jquery code <script type="text/javascript"> dropzone.options.dropzonejsform = { autoprocessqueue: false, init: function () { var submitbutton = document.queryselector("#btnsubmit"); var mydropzone = this; submitbutton.addeventlistener("click", function () { var productname = $("#txtprod").val();//<-- want send productname controlle

spring - Restrict bean creation count -

is there way restrict number of beans created in application using spring?. i tried seeing applicationcontextaware , beansfactoryutil. beansfactoryutils has method called countbeansincludingancestors() doesnt let me know if bean of particular type , on. any appreciable. i guess want restrict number of bean definitions. use beanfactorypostprocessor check it public class maximumbeandefinitionspostprocessor implements beanfactorypostprocessor { private int maximum = 100; @override public void postprocessbeanfactory( configurablelistablebeanfactory beanfactory) throws beansexception { if (beanfactoryutils.countbeansincludingancestors(beanfactory) > this.maximum) throw new beandefinitionstoreexception("maximun number of bean defintions execeeded [" + maximum + "]"); } }

c# - Syncfusion PDFViewer does not exist in the namespace -

i decided use pdfviewer control in on of features. i've included dependencies mentioned int documentation" syncfusion.compression.base syncfusion.pdf.base syncfusion.pdfviewer.wpf this namespace registered: xmlns:pdfviewer="clr-namespace:syncfusion.windows.pdfviewer;assembly=syncfusion.pdfviewer.wpf" and how have declared control inside grid: <pdfviewer:pdfdocumentview name="pdfviewer" allowdrop="true"></pdfviewer:pdfdocumentview> when tried run application got error: the name "pdfdocumentview" not exist in namespace "clr-namespace:syncfusion.windows.pdfviewer;assembly=syncfusion.pdfviewer.wpf". visual studio autocompletes control declaration , attributes, , able see preview xaml file. any ideas? syncfusion pdf viewer wpf not supported in client profile frameworks, please refer link supported frameworks , might cause of issue. kindly switch framework issue resolved. with referenc

php - Is there a way to use Ajax to monitor a file, and still update the file using Javascript -

i new web programming, , working on project button pressed on webpage uses javascript write simple value text file through basic php server file. webpage needs have other bells/whistles, , can make of required things work fine, monitor value in text file can show status on webpage. can read status using ajax code, or can send value server file, can't both work in same program. i figured have pause ajax code monitoring file while writing javascript, no matter how it, can't work. have tried toggling variable , putting ajax code in if statement. have tried executing ajax in while loop using same variable. an example of code have been trying is: <script type="text/javascript"> var togglebit; if (togglebit = 'on') { function savexmldoc() { var xmlhttp; if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } xmlhttp.onreadystatechange=function() { if (xmlhttp.rea

javascript - Create divs and add images on the fly -

i'm creating 4 divs , adding 4 images in each div. var divid = ["aa","bb","cc","dd"], imgid = ["a.png","b.png","c.png","d.png"]; for(var = 0; < divid.length;i++ ){ document.write('<div id="'+divid[i]+'" class="divcl"><input type="image" src="'+imgid[i]+'" class="imgcl"/></div>'); } css:- .divcl{ /*display: none;*/ } .imgcl{ width: 100px; height: 100px; } why isn't css applying? ok use method create divs , add images? well, document.write overwrite entire contents of dom once document loaded should not use this. should instead use document.getelementbyid select parent element want insert images , set .innerhtml of element new images. here example: html <div id="imgparent"></div> js var divid = ["aa","bb","cc"

c - how can u assign an integer value to a char datatype? -

in below code how can char data type assigned integer variable (as in char data type alphabets written in single quote) , while printing char data type using %d subscript instead of using %c ? #include <stdio.h> int main() { char = 30, b = 40, c = 10; char d = (a * b) / c;//a char value storing integer value ?how ? printf ("%d ", d); return 0; } how can char data type storing integer value char s small integers can hold values in range [-128;127] . (on systems may [0;255] . on rare platforms can have size, never see these cases.) character literals '0' codes of corresponding symbols. example, '0' equal 48 . (on encodings. values rare.) why %d works char ? because when pass char s , short s ... function argument, automatically converted ints. , printf declared printf(const char *, ...); .

ios - Use older swift version -

i got upgraded xcode 6.3 , project stopped compiling because of changes on swift 1.2 i wondering, there way can change swift version 1.1, can finish feature of app working on? thanks. it easier move forward , make app compile new version. it's more as-> as! or as? breaking changes 1.2.

c++ - Equivalent of Python's list sort with key / Schwartzian transform -

in python, given list, can sort key function, e.g.: >>> def get_value(k): ... print "heavy computation for", k ... return {"a": 100, "b": 30, "c": 50, "d": 0}[k] ... >>> items = ['a', 'b', 'c', 'd'] >>> items.sort(key=get_value) heavy computation heavy computation b heavy computation c heavy computation d >>> items ['d', 'b', 'c', 'a'] as see, list sorted not alphanumerically return value of get_value() . is there equivalent in c++? std::sort() allows me provide custom comparator (equivalent of python's items.sort(cmp=...) ), not key function. if not, there well-tested, efficient, publicly available implementation of equivalent can drop code? note python version calls key function once per element, not twice per comparison. you roll own: template <typename randomit, typename keyfunc> void sort_by

parameters with optional closures in swift -

i'm using optional closures, can't find way pass on parameter. searched everywhere, tried suggestions, can't work. my code: func doalert(title: string , message: string , actions: string , sender: anyobject? , ctlr : uiviewcontroller , seguestring: string? , yesclosure: ()->() = {} , noclosure: ()->() = {} , startclosure: ()->() = {} , endclosure: ()->() = {} ) { if (actions.rangeofstring("ok") != nil { alert.addaction(uialertaction(title: "ok", style: .default ) { action -> void in endclosure() })} } // end function i want add closure ok, 'self' parameter needed. something below: // add func doalert: , okclosure: (anyobject)->() = {} // add action ok (before endclosure: okclosure(sender!) getting error on first line: anyobject not subtype of () if leave anyobject out of first line, getting error: ca

amazon web services - Elastic Beanstalk: dictionary update sequence element #0 has length 1; 2 is required -

we had working elastic beanstalk environment, after adding config file, we've started getting error during deploy: error occurred during build: dictionary update sequence element #0 has length 1; 2 required the config file looks this: # .ebextentions/seed.config container_commands: 01_set_tenant_gateway: command: rake db:seed:set_tenant_gateway leader_only: true env: our-env the log gives this: 2015-04-09 18:27:48,220 [debug] running command seed_tenant_gateway 2015-04-09 18:27:48,220 [debug] generating defaults command seed_tenant_gateway <<< 2015-04-09 18:27:48,405 [debug] running test command seed_tenant_gateway 2015-04-09 18:27:48,406 [error] unhandled exception during build: dictionary update sequence element #0 has length 1; 2 required traceback (most recent call last): file "/opt/aws/bin/cfn-init", line 122, in worklog.build(detail.metadata, configsets) file "/usr/lib/python2.6/site-packa

android - Open Maps app showing sites near a lat-lon? -

is possible open google maps (android app or web site) displaying sites near location? i'm asking intent open googlemaps app display sites near location, not request sites google, forces app procees , display self. thanks yes possible , here backend api that stringbuilder sb = new stringbuilder( "https://maps.googleapis.com/maps/api/place/nearbysearch/json?"); sb.append("location=" + mlatitude + "," + mlongitude); sb.append("&radius=5000"); sb.append("&types=" + type); sb.append("&sensor=true"); sb.append("your api key");

K2: How may I open a file in a new window unless I already have such a window open? -

i have k2 smartform displays list of file names. when user clicks file name, program opens file (all of them pdfs) in new tab in browser (ie). far. if click on second file list, opens in third tab. not user wants. they want second file selection open in same window first file. this process can see: click on file in list. open in tab. click on second file in list. if there tab open file list, open file there. otherwise, open new tab file. i suppose automatically closing first tab when click on second file accomplish same thing. how can done? when deal opening links, first of all, can limited. indeed, browsers (ie, chrome, etc...) can configured users open links in new tabs, windows, etc... , form developer cannot change that. i have made jsfiddle reproduce situation , propose solution can test. don´t guaranty work use mac describe better solution below. you can find here: https://jsfiddle.net/chevdor/45k40npv/ i guess first example (#1) happens @ moment

ios - "Back" button is missing in my navigation controntroller -

i create standard navigation controller i editor > "embed in" navigation controller i create segue mother controller navigation controller, name it i perform custom segue: performseguewithidentifier(constants.seguelistmessagestomessages, sender:view) great, pops up. however, child view doesn't have button on navigation controller bar. i guess add bar button item...but can't find chevron apple uses "back" in symbols. why can't button there automatically? embed mother controller in navigation controller create segue link. [navigation controller] <-(relationship segue)-> [root view controller] -(show segue)-> [child view controller]

urllib2 - Python request.post while also using proxy - not working -

i having issue below code when try post login/pw access actual page want end at, time out 10060. however, if comment out post , response, log-in page (since trying access url without logging in). i have done on diff network did not require proxy without issue, using same payload. combo of proxy/post causing issue, , i'm not sure is. import requests bs4 import beautifulsoup url = "https://site/stuff_i_want" payload = { 'login':'login_name', 'password':'pw' } proxies={'http': 'http://domain\login:pw@proxy_ip:port', 'https': 'http://domain\login:pw@proxy_ip:port' } requests.session() s: p = s.post('https://site/login', data=payload) #w/o post login page loads, post time-out. r = s.get(url,proxies=proxies) print r.content

java - Searching a String in a file -

i wish write function in java searches specific string in text file. loop should use , how? (say while loop, what's condition?) the used loop while loop, because need loop , compare if string retired file not null . well, said, let's see code. solution can write open file first in bufferedreader instance you'll read line line , see if line contains string looking for. if does, can use boolean variable , assign true, else assign false. can have in java : public static boolean findstringfile(string lookingforme, string pathfile) { boolean found = false; try{ bufferedreader br = new bufferedreader(new filereader(pathfile)); try{ string line; while ((line = br.readline()) != null) { if (line.contains(lookingforme)) found = true; } } { br.close(); } } catch(ioexception ioe) { system.out.println("error whil

Laravel 5 mailgun works locally (Mac OS) but nothing happened on live server -

i developing web application using laravel 5, application needs send email members when registered. i use mailgun mail driver, works fine locally on mac book pro machine, means should configured correctly, when move ubuntu server (14.04), mailgun didn't send email out neither error message. i tried using curl command on server, works fine, means server should not block port mailgun. anyone please can on issue? as works 1 environment, , not in another, it's configuration problem. might differ in few places mail in laravel. you'll need check pretend in config/mail.php set false . see here . you'll need make sure .env file (if you're using .env) first renamed .env.example .env , check settings set correctly mailgun. wrote small tutorial mailgun laravel 5 here if have problems that. you'll need check third party services file in config/services.php configured correctly. more specifically, need ensure api key set correctly. if none of

Scopus API -> All citations to publication -

is possible citations concrete publication (by scopus_id, doi ...) elsevier api? i trying that, can do, count of citations, need authors annd titles al least. for example, if wanna do: https://api.elsevier.com/content/abstract/citations?pubmed_id=3472723&httpaccept=application/json&apikey={mykey} i get: "{"service-error":{"status":{"statuscode":"authentication_error","statustext":"requestor configuration settings insufficient access resource."}}}" is possible want? thanks i had same problem, found solution: firstly should have json article data , article's 'eid'. thus, can find citations of article next query: "https://api.elsevier.com/content/search/scopus?query=refeid(" + str(article['eid']) + ')' article json data of article also had problem keywords, , solution is: article json has article['prism:url'] parameter, , can use

c++ - std::mt19937 doesn't return random number -

i have following piece of code: unsigned int randomint() { mt19937 mt_rand(time(0)); return mt_rand(); }; if call code, example 4000 times in loop, don't random unsigned integers, instead example 1000 times 1 value , next 1000 times next value. what doing wrong? this happens because call f 4000 times in loop, takes less mili second, @ each call time(0) returns same value, hence initializes pseudo-random generator same seed. correct way initialize seed once , all, preferably via std::random_device , so: #include <random> #include <iostream> static std::random_device rd; // random device engine, based on /dev/random on unix-like systems // initialize mersennes' twister using rd generate seed static std::mt19937 rng(rd()); int dice() { static std::uniform_int_distribution<int> uid(1,6); // random dice return uid(rng); // use rng generator } int main() { for(int = 0; < 10; ++i) std::cout << dice() <

Fortran: How to skip many lines of data file efficiently -

i have formatted data file typically billions of lines long, several lines of headers of variable length. data file takes form: # header 1 # header 2 # headers of variable length. # data begins next line. 1.23 4.56 7.89 0.12 2.34 5.67 8.90 1.23 : : # billions of lines of data, each row same length, same format. -- end of file -- i extract portion of data file, , current code looks like: <pre> j=1,jmax !suppose want extract jmax lines of data file. [algorithm determine number of lines skip, "n(j)"] !this determines number of lines skip previous file !position, when data read on j-1th iteration. !skip n-1 lines go next data line read off: i=1,n-1 read(unit=unit,fmt='(a)') end !now read off line of data want: read(unit=unit,fmt='(data_format)'),data1,data2,etc. !data stored in arrays. end </pre> the problem is, n(j) can anywhere between 1 , several billion, takes

jquery - CSS3 filter performance & CPU usage: Why do certain filters tax the CPU? -

consider demo david nuon : http://zunostudios.com/demos/css32014-demos/filters.html as david notices in post: you'll notice more sliders right, less responsive page becomes. and true. after altered image, saw how cpu began work lot. what not answer myself why after css modifications page unresponsive. animations 2fps. if job done why keeps working? edit: of xengravity see maybe after filters right seems gpu following @ insane rate: 1.- takes original image. 2.- modifies (math calculations, blabla, etc). but starting original image. maybe thats why seems slow.... edit: added demo snippet future posterity var update_filter = function () { var styles = [ 'grayscale( ' + parseint($('#grayscale').val()) * .01 + ')', 'blur( ' + $('#blur').val() + 'px)', 'sepia( ' + $('#sepia').val() + '%)', 'brightness( ' + parseint(

ios - Error: Deployment Update target 8.3 NSMutableArray and addObjectsFromArray - swift -

after updating xcode , device functions not running anymore. see it: var jsonunico: nsmutablearray! = jsonresult["lista"] as? nsmutablearray self.tablelist.addobjectsfromarray(jsonunico) error: cannot invoke 'addobjectsfromarray' argument list of type '(nsmutablearray!)' it working yesterday before upgrading note: tablelist nsmutablearray swift 1.2 no longer implicitly converts between nsarray , swift’s native array type – need explicitly cast 1 other. since addobjectsfromarray takes swift array, means need convert [anyobject] . normally you’d more helpful error message: error: 'nsmutablearray' not implicitly convertible '[anyobject]'; did mean use 'as' explicitly convert? , offer “fix-it”. looks isn’t happening because of use of implicitly-unwrapped optional nsmutablearray! . but… isn’t such bad thing, since using implicitly-unwrapped optionals when fetching values out of dictionaries dangerous (if entry ev

Cakephp 3.0 - executing AppController::beforeFilter() in case of MissingRouteException -

in app, define (among other things) locale based on user's preference stored in cookie if any, or using browser's settings. of done in appcontroller::beforefilter(). problem: 404 errors thrown missing route exception, request doesn't event reach controller. error400.ctp template not rendered correct locale. so defining locale in appcontroller::beforefilter may not best practice. idea should this? i put logic in dispatcherfilter : http://book.cakephp.org/3.0/en/development/dispatch-filters.html you can take @ 1 inspiration: https://github.com/cakephp/cakephp/blob/master/src/routing/filter/localeselectorfilter.php

github - Can git tell me the current line number corresponding to a line number in an old commit? -

a bit of code in file.py on line 705 in old commit, created branch. since then, master has progressed , file.py has been modified, inserting 50 new lines near top. now, in branch modify file.py's line 705, , commit. merge branch master. git automagically knows change goes on line 755 in current file.py. there way can provide information without making change? is, given oldcommit:file.py:705 want produce master:file.py:755 . i prefer solution using github's web-based tools , api, if need use command line git suffice. according git blame man page: -n, --show-number: show line number in original commit (default: off). so git blame -n file.py add line number of line in blamed commit.

linux - Find especific directory and ignore other -

i need find iplanets on 1 server , thinking use command: find / type d -name https-* | uniq but @ same time need ignore directories/file. i've been trying use ! , not work. have command this: find / type d -name https-* ! -name https-admserv* ! -name conf_bk* ! -name alias* ! -name *db* ! -name classcache* | uniq i need ignore that. directories admserv , conf_bk , alias , tmp , files *.db* need find this: /opt/mw/iplanet/https-daniel.com /opt/https-daniel1.com /apps/https-daniel2.com i need find directory name. how can ignore other stuff? thanks use -prune keep recursing directories: find / \( -type d \( -name 'https-admserv*' -o -name 'conf_bk*' -o -name 'alias*' -o -name 'tmp' \) -prune -o -type d -name 'https-*' -print there's no need ignore files. you're selecting https-* directories, else ignored. and there's no need pipe uniq , since find never produces duplicates.

ng dialog - how to avoid the pre-clicked state on ngdialog -

Image
i'm using ngdialog display content on page, reason shows dialog's head in pre clicked view. i see old question, far it's not answered still, leave answer in order people leaded here. ngdialog.open({ template: 'template.html', trapfocus: false}); "trapfocus: false" trick, hope helps. cheers!

ms word - Creating invoice template with split voucher/invoice lines -

i using merge fields merge data onto word template. my template has 3 sections 1. check stock 2. invoice lines 3. invoice lines so in single page, invoice lines printed twice invoice lines fields specified in table. when merge happens, there might x number of rows added both tables. what needs happen: if there 20 rows, , each table can fit 10 rows, first page print 10 invoice lines on both tables , second page added print rest. expecting table rows break after number of lines what happening: first table prints in first page. second page prints second table instead of doing hte split what have tried: created table 3 rows fixed row heights. row 1: check stock row 2: invoice line table row 3: invoice line table when there more rows doesn't break inner (invoice line) table next page. initial layout: after adding more rows: outer table doesn't break next page http://i.stack.imgur.com/b3fy0.png http://i.stack.imgur.com/u6l1k.png any ideas ?

git - Recover detached head commit -

this question has answer here: can recover branch after deletion in git? 14 answers suppose following scenario. create branch in local git repository on master branch. checkout new branch , commits. checkout master branch again. delete newly created branch. now, there way go last commit made in newly created branch if not remember commit id of it? you can a: git checkout head@{1} or if use recent version of git: git checkout -

javascript - fluxxor add more than 1 set of actions to a flux instance -

i have set react application using fluxxor, trying use controller view gets multiple stores , actions, similar carousel example . however in fluxxor example uses multiple stores 1 set of actions. wanted know how pass in multple actions. var react = require('react/addons'), fluxxor = require("fluxxor"), authoractions = require("../actions/author-actions"), authorstore = require("../stores/author-store"), productactions = require("../actions/product-actions"), productstore = require("../stores/product-store"); var stores = { productstore: new productstore(), authorstore: new authorstore() }; // how combine actions here? var flux = new fluxxor.flux(stores, actions); fluxxor supports adding actions dynamically : var flux = new fluxxor.flux(stores); flux.addactions(authoractions); flux.addactions(productactions); if namespaces don't conflict, can merge them underscore's extend : va

PHP and jQuery realtime messaging system multiple problems -

i'm new ajax , i'm trying build real-time (facebook like) messaging system php , jquery. currently, when user loads page, messages loaded database. then, script sends request every 2 seconds latest messages database , displays them on page. however, after while, connection times out , if try reload website, website not load. load when use proxy. feel has server blocking ip. here current code (message refresh) $(function() { var m = $('.messages'); m.scrolltop(d.prop("scrollheight")); setinterval(function() { $.get("get_messages.php", function(result) { $('.messages').html(result); }); }, 2000); }); how can make more efficient/better? even though comments question good, rather answer in own way.. first off, polling server every 2 seconds.. in general should work, guess being blocked server.. specially if public/shared server .. have restrict traffic/high loads dont weight down o

jquery - AJAX success not working in IE9 -

i'm having trouble getting ajax work in ie9 , earlier. works in every other browser including ie10 gives failure response in ie9 , earlier. i've tried every solution i've seen suggested through couple of hours of googling , none have worked. my form @ kurbo.com/purchase_total.php here's code that's not working in ie9 or earlier: $.ajax({ url: "https://my.kurbo.com/api/v1/coupons/"+code, type: 'get', datatype: 'json', async:false, success: function( data ) { obj = data; if (!obj.error){ $('input[name="coupon"]').val(obj.data.code); $('#display-coupon').html(obj.data.description); var date = new date(); date.settime(date.gettime()+(30*24*60*60*1000));

In a relative layout, how to place a textview below an imagebutton and align it to the center of the imagebutton? -

in relative layout, have large imagebutton , have place textview below-center imagebutton. in textview declaration used android:layout_alignleft="@+id/button1 . because button bigger textview, layouts follows: ______imagebutton______ textview_______________ i wanted layout be: ____imagebutton____ _____textview______ how can this? assuming imagebutton not fill width of relativelayout , easiest way might add following textview : android:layout_below="@id/button1" android:layout_alignleft="@id/button1" android:layout_alignright="@id/button1" android:gravity="center" this make text view same width imagebutton centered text (which may or may not fit needs). if imagebutton occupies entire width of relativelayout , easier case -- can add following textview : android:layout_below="@id/button1" android:layout_centerinparent="true"

sql - Normalizing Table Data -

Image
currently, have setup tables , relationships: situation: there employees take courses. sign in on roster sheet unique course. these courses can taught several times different instructors. each course may have multiple rosters different students (different rosters different sessions). there other specifications part, employees/instructors table care about. my problem there can instances instructor employee. difference between 2 tables usage of instructorid rather employeeid. creates bit of redundancy data. want avoid , try build out based on best practices. there way combine data in 2 tables @ point, query tables instructors teach class employees? i thought of adding in "isinstructor" field yes/no in employees table. check see if person has yes or no. however, feel though terrible idea. suggested adding in prefix employeeid designate instructor. suggested perhaps add in field identifier instructors employees. essentially, want know best practice approach proble

livecode - Replacement only between begin{document} and \end{document} -

i have got of code stack-overflow , it's working, while changing code requirement(replacement between begin{document} , \end{document}) it's not working this code got put wordoffset("begin{document}",fld "mytextfield") tbegin put wordoffset("end{document}",fld "mytextfield") tend put replacetext(word tbegin tend of fld "mytextfield","bad","good") word tbegin tend of fld "mytextfield" i using following code. how convert above code requirement. on mouseup put htmltext of field "mytextfield" myhtml set casesensitive true put field srtext myarraytobe split myarraytobe cr put number of lines of (the keys of myarraytobe) myarraylength repeat = 1 myarraylength put myarraytobe[i] y split y colon put y[1] searchstr put y[2] replacestr if searchstr empty put 0 m el

ruby - Can I access a private class method from a public instance method without using the class name? -

i have class method, self.calculate , want invoke both class method , instance method. if write def green calculate(x,y,z) end though, nomethoderror: undefined method 'calculate' exception. invoking self.calculate gets same problem. what does work calling myclassname.calculate , seems somehow wrong , messy. correct practice in situation? you can use self.class.calculate to call class methods instance method.

React Native textInput max length -

how set such attribute? example ccv field of credit card should have max length of 3. expiry date should have max length of 2 month , 4 years. the maxlength prop part of react native: <textinput value={this.state.text} maxlength={4} />

How to apply marquee to the Button programmatically in Android? -

i'm trying add marquee alert button(negative button) text. code: builder.setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { toast.maketext(getapplicationcontext(), "clicked yes", toast.length_long).show(); } }); builder.setnegativebutton("dont showdont showdont showdont showdont showdont showdont showdont show", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } }); builder.setneutralbutton("dont show", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { toast.maketext(getapplicationcontext(), "clicked neutral", toast.length_long).show(); } }); alertdialog alertbox = builder.create(); alertbox.show(); button button