Posts

Showing posts from April, 2010

c# - Caliburn.Micro attach event handler on event of Behavior -

i wrote own behavior handle swipe gesture , put itemtemplate of listview. if swipe completed, raise event leftswipe or rightswipe. event should handled viewmodel. i use syntax of caliburn.micro attach handler event: cm:message.attach="[event leftswipe] = [leftswipe($source, $eventargs)" . this behavior: public class swipeinteractionbehavior : dependencyobject, ibehavior { public dependencyobject associatedobject { get; private set; } public void attach(dependencyobject associatedobject) { // ... } public void detach() { // ... } public event eventhandler leftswipe; public event eventhandler rightswipe; // ... // ... private void onleftswipe(frameworkelement element) { // ... if (leftswipe != null) { leftswipe(this, eventargs.empty); } } private void onrightswipe(frameworkelement element) { // ... if (rightswipe != null) ...

java - Cannot find id with R.id -

this activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <textview android:id="@+id/mytext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new text" /> </linearlayout> textview has in id of mytext , java file trying access view: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); view mytextview = (textview)findviewbyid(r.id.mytext); // here mytextview.settext("new text in text view"); } but mytext has red color font meaning not resolved. why so? how can fix it? update: my imports: pac...

(R) How can I force substitution of a vector element in a formula? -

i'm trying use formula expressed in terms of element of vector. element not substituted when formula built; instead left in component---i'd prefer if actual value substituted in immediately. (this breaks else later in code.) c <- c(5:8) #made vector on purpose, though use c[1] form <- as.formula(y ~ exp(-(x-c[1])^2/2)) at point form contains y ~ exp(-(x - c[1])^2/(2)) i'd contain y ~ exp(-(x - 5)^2/(2)) . the bquote makes pretty easy plug vlaues formulas. example form <- bquote(y ~ exp(-(x- .( c[1]) )^2/2)) form # y ~ exp(-(x - 5l)^2/2) note add "l" indicate integer literal value (as opposed general numeric value). because 5:8 creates integer vector.

Preparing Cassandra SELECT Statements in Python -

i'm trying run prepared select queries against cassandra table. the table defined such: class emailaddresslookup(model, modeloperations, jsonserializer): __table_name__ = 'email_address_lookup' email_address = columns.text(primary_key=true) user_id = columns.integer(primary_key=true) my insert works great. looks this: i_email_lookup = session.prepare("""insert email_address_lookup (user_id, email_address) values (?, ?)""") session.execute(i_email_lookup, (user_id, email_address)) however, select not working. looks this: s_email_lookup_by_email = session.prepare('select user_id email_address_lookup "email_address"=?') session.execute(s_email_lookup_by_email, email_address) here's traceback when email_address 27-char string: traceback (most recent call last): file "/home/thisguy/documents/my_proj/api/models/case.py", line 428, in _lookup_usin_email matches = my_projcluster...

python - Apply function to column in pandas dataframe that takes two arguments -

say have mapping: mapping = { 'cat': 'purrfect', 'dog': 'too work', 'fish': 'meh' } and dataframe : animal name description 0 cat sparkles nan 1 dog rufus nan 2 fish mr. blub nan i programmatically fill in description column using animal column , mapping dict inputs: def describe_pet(animal,mapping): return mapping[animal] when try use pandas apply() function: df['description'].apply(describe_pet,args=(df['animal'],mapping)) i following error: typeerror: describe_pet() takes 2 arguments (3 given) it seems using apply() trivial passing 1 argument function. how can 2 arguments? the suggested answer solves specific problem, more generic case: the args parameter parameters in addition columns: args : tuple positional arguments pass function in addition array/series pandas.dataframe.apply

parsing - PHP Parse/Syntax Errors; and How to solve them? -

Image
everyone runs syntax errors. experienced programmers make typos. newcomers it's part of learning process. however, it's easy interpret error messages such as: php parse error: syntax error, unexpected '{' in index.php on line 20 the unexpected symbol isn't real culprit. line number gives rough idea start looking. always @ code context . syntax mistake hides in mentioned or in previous code lines . compare code against syntax examples manual. while not every case matches other. yet there general steps solve syntax mistakes . references summarized common pitfalls: unexpected t_string unexpected t_variable unexpected '$varname' (t_variable) unexpected t_constant_encapsed_string unexpected t_encapsed_and_whitespace unexpected $end unexpected t_function … unexpected { unexpected } unexpected ( unexpected ) unexpected [ unexpected ] unexpected t_if unexpected t_foreach unexpected t_for unexpected t_while unexpected t_do ...

android - How to import facebook sdk, version 4.2.0 in eclipse? -

when follow android sdk steps of facebook developers website, can not find build.gradle in eclipse. that make me stop in step. can me find file details? or can tell me how add facebook sdk in eclipse? please.thank you. to import new facebook sdk should https://developers.facebook.com/docs/android -then when download it, copy following folder proyect directory: facebook -import proyect workspace. -add facebook sdk library in eclipse. right click on proyect-->properties--> android , add library. thats all!

ios - How to format some text as bold within a UILabel? -

this question has answer here: any way bold part of nsstring? 9 answers i have ios uilabel needs of text normal , of text bold. bold text supposed link part of app, now, i'm reacting tapping on entire label. how can format of text bold? use attributedtext property: nsmutableattributedstring *text = [[nsmutableattributedstring alloc] initwithstring:@"this test."]; [text addattribute:nsfontattributename value:[uifont boldsystemfontofsize:12] range:nsmakerange(0, 4)]; label.attributedtext = text;

Match two alternative or either both words with regex in Java -

in java need find regex able match sentences : "john smith wants dog , cat" "john wants fish , snake" "smith wants spider , horse" the same shall not match if instead of "john" or "smith" or "john smith" there's nothing or different word. example shall not match if sentence like: "jack wants bird , frog" "wants banana , lemon" also words in place of animal names shall match capturing groups. i tried many combination i'm not able find right "formula" because matches if there different words or empty @ beginning. example this: (john )?(smith )?wants ([a-z]*) , ([a-z]*) but works if input: "wants tiger , lion" by finding "tiger" , "lion" groups, while in case don't want match far there's no (the right) name @ beginning. hope explanation clear enough..... thanks you need use or between fname , lname : (?:john|smith|j...

How to get autocomplete of CSS3 properties on Eclipse inside the <ui:style> tag of GWT UiBinder? -

i can enable autocomplete of css3 properties .css , .gss files on eclipse following this answer nitin dahyabhaifriend: the default profile in luna still css2. bring properties dialog web project , can change default css profile project on web content settings page. if css file not in web project, or if don't want use project default, can set using file's properties dialog (also web content settings page). ... doesn't enable autocompletion of css3 properties (such background-position, border-radius , on) inside *.ui.xml files (gwt uibinder). example: <ui:style> .randomstuff { background-repeat: no-repeat; background-position: center; background-s <ctrl+space... no luck!> } </ui:style> how can enable autocomplete of css3 inside files?

c++ - Share variable between two lambdas -

i want able share variable in containing scope between 2 lambda functions. have following: void holdadd(const rect& rectangle, hold anonymousheld, hold anonymousfinish) { std::map<int,bool> identifiercollection; holdfinish holdfinish = [=](const int& identifier) mutable { if (identifiercollection.count(identifier) == 0) return; identifiercollection.erase(identifier); anonymousfinish(); }; holdcollisioncollection.push_back([=](const int& identifier, const vec2& point) mutable { if (rectangle.containspoint(point)) { identifiercollection[identifier] = true; anonymousheld(); } else { holdfinish(identifier); } }); holdfinishcollection.push_back(holdfinish); } i can see in debugger holdfinish pointing different implementation of identifiercollection in 2nd lambda function. if use [=, &identifiercollection] throws exc_bad_access whether use mut...

ios - Accessing JSON elements in PHP -

php noob here. building iphone app sending json blobs web server. on server side receiving json , trying access 3 fields object contains. two weird things happening me not figure out how fix: i not getting when printing out decoded object($post_data below). i able print full object in xcode when printing object without decoding ($content below) have no idea how access various fields in object. my php code: $con = mysql_connect("127.0.0.1","root", "") or die('could not connect: ' . mysql_error()); $content = file_get_contents('php://input'); $post_data = json_decode($content , true); echo $content; --> prints object echo $post_data; --> not print echo $content->lat; --> not print my json object: { "lat" : 37.33233141, "long" : -122.0312186, "speed" : 0 } any appreciated. it's because json_decode($content, true) returning array, has problems displaying if echo...

How to configure email settings in ASP.NET 5? -

Image
how configure mail settings <system.net><mailsettings> used in web.config in asp.net 4? guess need call services.configure<>() have no idea options should pass. ideas? thanks, f0rt try way keep secrets secret. first, install secretmanager , configure secrets. when you're on local machine, you'll want use values secretmanager . hosting (e.g. in azure) you'll use environmental variables. local: install , configure secretmanager dnu commands install microsoft.extensions.secretmanager user-secret set "smtp-host" "smtp-mail.outlook.com" user-secret set "smtp-port" "587" user-secret set "smtp-username" "myusername" user-secret set "smtp-password" "@#$hfs%#$%sfsd" there's bug makes go awry if have vs 2015 rc installed. there's workaround here. live: use environmental variables here's example in ms azure web app, though other web hosts have sim...

python - Does a daemon thread run in the background? -

i confused daemon , non daemon thread in python. read non daemon thread exits when main thread exit in python! but here read in java daemon thread runs in background! i have read many different discussions on stackoverflow daemon , non daemon threads, still confused! can please clarify thread able run in background using python? try this: import threading help(threading.thread) then scroll down documentation of data descriptors, in particular "daemon" flag. there, find info: daemon boolean value indicating whether thread daemon thread. must set before start() called, otherwise runtimeerror raised. initial value inherited creating thread; main thread not daemon thread , therefore threads created in main thread default daemon = false. entire python program exits when no alive non-daemon threads left. in particular last sentence important, because questions implicitly answered that. note contradicts first claim "non ...

java - Make JOptionPane Print More Than One Set Of Data -

Image
can explain me how can print 3 rows of customer data in 1 dialog box in screenshot below? right prints 1 row @ time. string custnum = joptionpane.showinputdialog("enter cust numb:"); while (!custnum.equalsignorecase("quit")) { string custname = joptionpane.showinputdialog("enter cust name:"); { try { kilowattused = double.parsedouble(joptionpane.showinputdialog("enter kilowatt(s) used:")); } catch (numberformatexception e) { kilowattused = minkilowatt - 1; } if (kilowattused < minkilowatt || kilowattused >= maxkilowatt) { joptionpane.showmessagedialog(null,"please enter valid number"); } } while (kilowattused <= minkilowatt || kilowattused >= maxkilowatt); if (kilowattused < lowratekilowattmin) { amtowed = kilowattused * highrate; } ...

c# - How to create a function to hold one block of code and then execute? -

i have 2 buttons contain own functionality (which have not included in code snippet below not relevant), contain same block of text (which shown in code snippet below). question beginner in c#, there way can write code once , use function shall call placed in buttons instead? code snippet: private void btnalpha_click(object sender, eventargs e) { //replace non alpha code go here… /*count number of lines in processed text, line counted -1 brings correct number*/ int numlines = copytext.split(“/n”).length - 1; //seperate characters in order find words char[] seperator = (" " + nl).tochararray(); //number of words, characters , include line breaks variable int numberofwords = copytext.split(seperator, stringsplitoptions.removeemptyentries).length; int numberofchar = copytext.length - numlines; //unprocessed summary newsummary = nl + "word count: " + numberofwords + nl + "characters count: " + numberofchar; } private void...

session - LinkedIn Login as Authentication for PHP pages -

i have built website users able login linkedin accounts. managed linkedin connection using tutorial: http://thinkdiff.net/linkedin/integrate-linkedin-api-in-your-site/ bit stuck because php pages (home.php, account.php, etc..) accessible if logged in via linkedin. far can login using linkedin (like tutorial) can access pages, supposed authorized using linkedin, directly url. i believe in order accomplish have store authentication response linkedin value in session variable , checking on each .php page, secured, see if value set. any great, posts have read regarding linkedin have hyperlinks no longer existing api & code examples. yes. need store login in session variable , put php @ front of every page want protect. this answer has code need.

random - How to uninitialize the entropy of /dev/urandom in C? -

is there way make entropy of /dev/urandom , stay uninitialized? my goal simulate initialized or uninitialize /dev/urandom. how can such thing? edit: see question has been downvoted. sure person did has legitimate reason. have spent time searching answer online didn't find anything. as /dev/random , urandom vital security functions, allowing tamper them contradict purpose. can add own driver, or replace calls them dummies (or use named pipes dummy testing) instead. note: not replace driver on production system.

objective c - How to Restrict Access Parse.com API to One Only Session Token (One Device) per Time? -

i'm developing app use parse.com backend : i can login device same pfuser in same time i can change in 1 device , see change in other device in small words, works ! my goals 1) possible restrict login 1 device per time ? 2) if yes, how can disconnect previous device when new 1 login ? thanks

python - "save and add another" in Django (not admin): submit then pre-populate one field of form -

i have form, "results", 1 of fields, "subjectid", many-to-many because there's more 1 result each subject. want 1 of submit buttons let me save i've entered, redirect same form, unbound except many-to-many "subjectid" field stays same can enter more results subject. edit : should have made clear wanted instance had selected in subjectid field stay same. posted code below seems working me from models.py class resultsform(forms.modelform): class meta: model = models.results fields = ['subjectid', # field want # populate form when "save , add another" 'slidenum', # integerfield 'resulttype' ] # foreignkey from views.py def addresults(request): if request.method == 'post' form = resultsform(request.post) if form.is_valid(): form.save() if 'save_and_add_another' in request.post: ...

ios - Deploying app on tester's device unable to save record in iCloud -

my app uses cloudkit save records , works fine on phone. added friend of mine's device 'devices' , uploaded app phone. set icloud dashboard 'production' , tried add record phone. can access database, , fetch data, cannot save record. both have iphone 6+ , have exact same builds of app. can add records on phone no prob. apple not allow this? if it's in public database, make sure security roles (in cloudkit dashboard) set such allow writes authenticated users record type in question. maybe have set have role write record type?

amazon web services - how does aws datapipeline scheduling work -

Image
i noticed strange behavior aws data pipeline. execution start time before scheduled start time . please refer screenshot below. am missing here ? is acceptable behavior aws data pipline ? recommended way avoid ? data pipeline here recording creation of instance execution start time. not start execution (running state) before scheduled start time. can verify clicking on instance, view fields, has additional info. this misleading. data pipeline needs fix recording of timestamps.

Get Parent Container Text field in Android -

i have parent container has viewpager inside it. inflate viewpager in viewpageradapter set slider. apart moving slider, require reference viewpager parent can populate text field in it. inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); view itemview = inflater.inflate(r.layout.viewpager_item, container, false); how can reference text field in parent container itemview? complete code - view itemview = inflater.inflate(r.layout.viewpager_item, container, false); view fragmentview=inflater.inflate(r.layout.fragment_first_scroll_view, container, false); // locate textviews in viewpager_item.xml txtrank = (textview) itemview.findviewbyid(r.id.rank); txtcountry = (textview) itemview.findviewbyid(r.id.country); //txtpopulation = (textview) itemview.findviewbyid(r.id.population); txtpopulation=(textview) fragmentview.findviewbyid(r.id.population); // capture position , set...

git - linked local repo to incorrect github account -

as part of coursera data scientist course set up, incorrectly linked directory, test-repo, incorrect account. so, in statement: git remote add origin https://github.com/yourusernamehere/test-repo.git i incorrectly specified user name. i'm thinking can delete directory , reset again. i've researched ability either delete directory or re-link right account have not found information can me so. appreciate guidance. to change url of remote, use git remote set-url <name> <newurl> , in example git remote set-url origin https://github.com/yourusernamehere/test-repo.git removing remote , adding again suggested in comment @xwhylikethis work.

c - Does the dart VM impose restrictions on the stack memory size of a native extension? -

i'm learning write native extension , noticed odd occurrence. when allocate multidimensional array , access so: (excuse messy c code , bad practices might using unless they're cause of error. c not-so-great) int table[rows][cols]; //rows , cols both > 1 memset(table, 0, sizeof(int) * rows * cols); i segmentation fault if like table[rows-1][cols-1]; but if allocate table so: table = (int**)malloc(xlen * sizeof(int *)); if (table == null) { ... error ... } (i=0; < xlen; i++) { table[i] = (int*)malloc(ylen * sizeof(int)); if (table[i] == null) { ... error ... } memset(table[i], 0, sizeof(int) * ylen); } then works fine. why might be? maybe problem in in first case allocate array on stack? if use reference array outside of function (after when function returns) segmentation fault. please give small example of use of array , you'll more useful advice.

java - how to define path to superpom? -

any maven experts out there? inherited huge maven project , trying compile. not getting far. go highest level pom.xml can find, located in trunk directory, 1 level down main project. issue command "mvn validate". following error: [info] scanning projects... downloading: http://repo1.maven.org/maven2/com/mycompany/neto/vsd/vsd-superpom/1.1.0/vsd-superpom-1.1.0.pom [info] unable find resource 'com.mycompany.neto.vsd:vsd-superpom:pom:1.1.0' in repository central (http://repo1.maven.org/maven2) i noticed vsd-superpom folder @ same level main project i'm guessing main project needs point somewhere? looking @ pom.xml see <parent> <groupid>com.mycompany.neto.vsd</groupid> <artifactid>vsd-superpom</artifactid> <version>1.1.0</version> </parent> where put vsd-superpom folder found? don't understand why tries download it. don't see in pom.xml tells that. apache maven has 2 le...

c# - Can't add a tag using system.io file, as i need it to be cast as a fileinfo object later in my code -

the tag file anode causing errors directory anode, because 1 , same? think casting tag fileinfo object isn't working. suggestions how fileinfo nodes user selects populate listview? //see code below attempts made add tags foreach (directoryinfo subdir in subdirs) { anode = new treenode(subdir.name, 0, 0); anode.tag = subdir; anode.imagekey = "folder"; anode.imageindex = 0; anode.selectedimageindex = 1; subsubdirs = subdir.getdirectories(); if (subsubdirs.length != 0) { getdirectories(subsubdirs, anode); } //add files treeview foreach (var file in subdir.getfiles()) { if(file.name.contains(".rfa")) { anode.nodes.add(new treenode(file.name)); //cant add tag file directory anode.tag = file; ...

android - ArrayList<String>() and SharedPreference using ObjectSerializer -

i have application saves array list of string , serializes using objectserializer saves serialized list in sharedpreferences instance. it involves 2 activities "putting" , "getting" same sharepreferences object. in listactivity , long-click item start deletion process. after string deletes, re-initialize listadapter updated arraylist<string> object update listview . after restart listacivity calling again, item reappears in list. causes nullpointerexception when clicked because points object doesnt exist anymore ( null ). i have tried removing items arraylist<string> , putting in objectserializer sharedpreferences . tried removing old sharedpreference value (using clear() or remove() methods). maybe i'm overlooking step, cannot figure out can causing it. would able show or walk me through how serialize arraylist<string> , save sharedpreference object, remove , item list, , update sharedpreference object can same (cor...

Python internal error Handling -

i'm having issues program closing @ random stages , not sure why. at first, thought because getting error added error handle. still reason closes after few days of running , no error displayed. code below import requests import lxml.html lh import sys import time clint.textui import puts, colored api_url = "http://urgmsg.net/livenosaas/ajax/update.php" class scraper (object): id_stamp = 0 def __init__(self, timeout, recent_messages=true): self.timeout = timeout self.handlers = [] self.recent_messages = recent_messages def register_handler(self, handler): self.handlers.append(handler) return handler def scrape(self): try: resp = requests.get(api_url, params={'f': self.id_stamp}).json() except requests.exceptions.connectionerror e: puts("error encountered when connecting urgmsg: ", newline=false) puts(colored.red(e.__class__.__name__), n...

javascript - Send ng-repeat data from one page to another page - angular -

i have 1 table , iterating tr on click of button <table class="addedproject" ng-show="show" width="100%" border="1" cellpadding="10" > <tr ng-repeat="developeradd in developer" ng-click="adddev(developeradd);"> <td > <ion-item menu-close href="#/app/playlist" >{{ developeradd.devname }}</ion-item> </td> <td><ion-item menu-close href="#/app/playlist" >{{ developeradd.emailid }}</ion-item></td> <td><a class="button button-small button-dark" ng-click="removedev($index)">x</a></td> </tr> </table> <button class="button button-block button-positive" ng-click="adddeveloper()">add developer</button> this page x i want iterated tr in new page y. here controller. .controller('...

angularjs - Controllers and how they should be implemented in Angular? -

sorry if seems stupid or simple question little confused, have been looking many different kinds of tutorials angular understand concept , how create application. the issue how attach controller page, have seen 2 methods: add controller script page display controller inside app.js website routing is. here have @ moment please let me know if there issues in code: var app = angular.module('myapp', [ 'ngroute' ]); app.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/', { templateurl: 'partials/home.html', controller: 'homecontroller' }). when('/login', { templateurl: 'partials/login.html', controller: '' }). when('/signup', { templateurl: 'partials/signup.html', controller: '' }). when('/dashboard', { templateurl: 'partials/dashbo...

java - What keywords should I use in a for-loop when using if-statements? -

let's assume have for-loop loop through collection or array of strings. in case, searching specific keyword (ex. hey) here's how achieve that: for (string result : strings) { if (result == "hey") { // that. break; } } now, question arises code snippet is, should place keyword (return or break) when if-statement returns true loop not continue? if not, happen , what's correct way of going it. edit: happens when use break , return? what's difference? let's put code inside method: private void foo() { (string result : strings) { if (result.equals("hey")) { // that. break; } } bar(); } if use break; , loop terminate , bar reached. if use return , method terminate , bar won't executed. note comparing strings should done using equals , == compares references , not content.

matrix - training and testing image data with neural network tool in MATLAB -

my original pictures gray scale 200x200x3. i have downscaled them 50x50x3. they mug shots of 100 different people. have taken copy of 30 of them, , corrupted, , put in same image matrix cell, , became 130 pictures. afterwards, have created 130x7500 array involves each picture row. then, have classified matrix training , test data set. then, classified divided data using matlab decision tree tool, , knn tool. question is, how manage using neural network tool. and have classification matrix 130x1. if want same thing using neural network tool, should do?

How to run nunit tests with asp.net 5 projects, especially with ReSharper? -

i developing asp.net 5 application targeting dnx451. the asp.net 5 project relies libraries unit-tests written nunit 2.x. reasonable choice me use nunit testing asp.net 5 project. when running unit test in resharper, resharper says "test not run" additional message "system.io.filenotfoundexception: not load file or assembly xxx ". both nunit 2.6.4 , 3.0.0-beta-2 results same error. any 1 has running nunit tests against dnx project? dnx tests aren't supported resharper. it's whole new execution model, , hasn't yet been implemented resharper. i'd expect see support dnx , asp.net stabilise , near release. also, don't believe nunit supports running dnx test runner - xunit team have separate project plug dnx: https://github.com/xunit/dnx.xunit

python - Pygame Changing Hue of Image -

i have question python module pygame. i want change hue of image sprite, applying filter image. have seen many posts concerning changing specific pixels 1 color another, although not want do. want similar can done in simple photo editing software such paint.net, changing overall color of image. of course change hue of image in photo editing software, lead lots of images needing made , loaded , managed, become tedious. hoping there sort of way change hue of image in pygame. you can python pil. take @ question , answer, , original question , answer link to: https://stackoverflow.com/questions/11832055/changing-the-color-of-an-image-based-on-rgb-value

javascript - Converting a Distance string into a Number -

when using google api calculating distance between 2 location, returns me distance in string format. for example: 1,585 km, 54 km etc. i want converted number. best way convert string 1,525 km number 1525 ? if using google maps distance matrix api , there field in distance object called value has number value. documented in api, units metres. but answer original question, remove non-digit characters string using regular expression: var dist = '1,525 km'; dist = number(dist.replace(/[^\d]/g, ''));

javascript - Morris donut chart always start at 12 oclock (top middle) -

Image
i using morris donut charts , want try , ensure segments start @ 12 o'clock there consistency when viewing multiple charts on same screen. previously used jquery circliful https://github.com/pguso/jquery-plugin-circliful worked great quality fuzzy on retina screens checked out morris , want bar this. i want looks first segment starts @ top middle: does know how achieve this? var donut= morris.donut({ element: 'donut-example', data: [ {label: "new clients", value: 35}, {label: "in-store sales", value: 65} ], colors: ['#90c070', '#eeeeee'], select :0 }); donut.select(0); http://jsfiddle.net/0t976ez6/ no, far can tell source code, there's no api (public or private) in morris that. see donut's redraw() how renders chart: starts lowest point , goes in counterclockwise direction. now, recommend consider switching other chart libraries, before proceeding. example there's d3.js — no...

apache pig - Program in Python -

this question has answer here: python pig latin converter 2 answers this code have make pig-latin translator , can't seem translate, have tips make work? i think issue within encode , starts vowel parts can't seem figure out. adjust these 3 functions: def starts_with_vowel(word): # return true if word starts vowel , false otherwise return word[0] in ['a', 'e', 'i', 'o', 'u'] def encode(word): # translate single word secret language # call starts vowel decide pattern follow if starts_with_vowel(word): return word[1:] + word[0] + 'ar' else: return word + 'way' def translate(message): # translate whole text secret language # call encode translate individual words in text return ' '.join(encode(word) word in message) the biggest pro...

facebook - Android FacebookSDK V4.20 Login and Logout using LoginManager -

after spending days trying figure out, couldn't come worked. using code, shows me permission form accept , log in doesn't onsuccess, onerror or oncancel. anytime click button, doesn't anything. , no errors on logcat. don't know i'm going wrong. fb = (button) findviewbyid(r.id.fb_button); fb.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { loginmanager.getinstance().loginwithreadpermissions(loginactivity.this,permissionneeds); callbackmanager = callbackmanager.factory.create(); loginmanager.getinstance().registercallback(callbackmanager,new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { log.d("kkkkkk","kkllkl"); } @override public void oncancel() { log.d("kkkkkk","kkll...

arrays - Yii2 - mailer - send message to email rows in database -

greetings, i need send email several recipients stored in table named mail has field called email. in controller created action query table mail emails. later tried use implode() function separated comma, didn't work because of mailer policies. generated wrong format -> "email1@mail.com, email2@mail.com, email3@mail.com". tried each loop , serialize() function without success. the json_encode() function close need, separate array of emails -> "email1@mail.com", "email2@mail.com", "email3@mail.com". appends field name before value , not accepted mailer policies. so far i'm stuck following code: public function actionsucesso() { $query = new query; $query->select('email') ->from('mail'); $command = $query->createcommand(); $enderecos = $command->queryall(); $enviar = json_encode($enderecos); yii::$app->mailer->compose() ->setfrom('atf@webs...