Posts

Showing posts from February, 2011

jquery - AngularJS-1.4 throws $injector:unpr error for use of `angular-adaptive-templating` -

in app, called responsive , controllers using matchmedia-ng , templating using angular-adaptive-templating using repo angularjs version 1.4.1 , but getting error : http://errors.angularjs.org/1.4.1/$injector/unpr?p0=eprovider%20%3c-%20e%20%3c-%20%24http%20%3c-%20%24templaterequest%20%3c-%20%24compile how solve it? or using matchmedia-ng possible handle adaptive-templating . please me sort issue. thanks in advance. my js : "user strict"; angular.module('responsive', ['ngroute', 'matchmedia-ng', 'adaptivetemplating']) .config(function ($routeprovider, $locationprovider) { $locationprovider.html5mode(true); $routeprovider .when ("/", { templateurl : "views/home.html", controller : "homecontroller", reloadonsearch: false }); $routeprovider .otherwise ({ redirectto:

scala - Convert Future result into json -

i have 2 model communication: case class post(id: int, name: string, text: string) case class tag(id: int, name: string) and create json format models: import play.api.libs.json._ object myformats { implicit val postformat = json.format[post] implicit val tagformat = json.format[tag] } then create service (actor) can return okresponse or badresponse sealed trait response case class okresponse[t](model: t) extends response case class badresponse(msg: string) extends response // easy example case class message(id: int) class myactorservice extends actor { def receive = { case message(id) => if (id == 0) { sender ! okresponse(post(1, "foo", "bar")) } else if (id == 1) { sender ! okresponse(tag(1, "tag")) } else { sender ! badresponse("id overflow") } } } then want convert model okresponse json value: (myactorservi

colors - android studio cannot resolve symbol "ff" -

i trying retrieve value of red, green,blue pixel color value .so need perform shift , multiply operation.but android studio notifying above error @ following code. clr=bm.getpixel(0,0); cred=(clr & 0*ff)>>16; tv.append((string.valueof(clr))); tv.append((string.valueof(cred))); error:cannot resolve symbol ff @ line no 2; it should 0xff , not 0*ff cred=(clr & 0xff)>>16; 0*ff multiplying 0 unknown symbol ff (since don't have variable named ff in scope) while above code compile , resolve error, not correct code reading red color value bitmap pixel. correct code be cred = (clr >> 16) & 0xff; but easiest , safest way use color class. int = color.alpha(clr); int r = color.red(clr); int g = color.green(clr); int b = color.blue(clr);

javascript - how to do time over in games per socket in node js -

i develop poker game using nodejs in server , html5 in client. all core logic in server , not in client. because client can edit javascript , change logic of game benefit. i want make timeover function client. example, if doesnt play in 30 seconds, default action(check/fold). my question how it? cant in javascript because client can edit it. , if i'll in server, isn't block server? thought of openning new thread each socket, , timeout function there, it'll not efficient, if got 10k sockets? you can set timeout each socket using socket.settimeout . if timeout due inactivity reached socket closed. maybe you. read more here

javascript - why facebook is not working in Iframe -

facebook.com not running in frame reason. <iframe name="iframe1" src="http://www.facebook.com"></iframe> facebook.com doesn't allow it's main page included in iframe , because set x-frame-options http header deny . if in console, you'll see: refused display ' https://www.facebook.com/ ' in frame because set 'x-frame-options' 'deny'. if want around can: if develop yourself, can use browser plugin, example: https://chrome.google.com/webstore/detail/ignore-x-frame-headers/gleekbfjekiniecknbkamfmkohkpodhe however, it'd best if you'll use plugins they've exposed developers: https://developers.facebook.com/docs/plugins .

ios - Exception while Passing nil as argument to stringWithString:? -

i have below 2 piece of code in case application did not crash. [nsarray arraywitharray:nil]; but if passing nil stringwithstring: application crashed. [nsstring stringwithstring:nil]; result uncaught exception ' nsinvalidargumentexception ', reason: '*** - [nsplaceholderstring initwithstring:] nil argument' what reason behind ? it depends 100% on implementation of method calling if nil parameter allowed. in general passing nil allowed. if rely on non-nil parameter passed in raise exception. apple / ios developers decided calling arraywitharray:nil result in empty array. stringwithstring:nil decided not allowed pass in nil , therefore raise exception. for reason why decided way did, might want go apple developer forums , ask devs there.

javascript - Return contents of one field (an array) from Mongodb document in Meteor -

i working in meteor , trying retrieve contents of 1 field in mongodb document. particular field array. i've read mongo docs , several related questions, projection isn't working. have: user adds array using following form: template.one.events({ 'submit form': function(e) { e.preventdefault(); var currentid = this._id var oneproperties = { selections: $(e.target).find('[name=selection]').val() }; charts.update(currentid, ($addtoset: selections}, function() {}); } }); resulting document: { "_id": "some id", "selections": ["a","b"] } refer array in helper different template access documents different collection. template.two.helpers({ comps: function() { var selected = charts.findone({_id:this._id}, {selections:1, _id:0}); return companies.find({ticker: {$in: selected}}); } }); when run charts.findone que

c# - Web Usercontrol menu item dynamic selected style not working -

i have web user control,it include menu.it have 4 menu items,i using style sheet dynamic , static selected style.but static , dynamic selected style not working.how solve problem 2, codebehind of menuitemclick event: protected void menu1_menuitemclick(object sender, menueventargs e) { session["selected"] = e.item.text; if (e.item.text == "page1") { response.redirect("~/menu/default.aspx"); } else if(e.item.text == "page2") { response.redirect("~/menu/default2.aspx"); } else if (e.item.text == "page3") { response.redirect("~/menu/default3.aspx"); } } page load on user control protected void page_load(object sender, eventargs e) { if (session["selected"] != null) { (int = 0; < this.menu1.items.count; i++) { if (this.menu1.items[i].text == session["selected"].tostring())

php - How to add event to a date in fullcalender on clicking a date -

i using fullcalender. presently adding event date using drag option.now need add event clicking on particular date. is there option? i found code in documentation : $('#calendar').fullcalendar({ dayclick: function(date, jsevent, view) { alert('clicked on: ' + date.format()); alert('coordinates: ' + jsevent.pagex + ',' + jsevent.pagey); alert('current view: ' + view.name); // change day's background color fun $(this).css('background-color', 'red'); } }); edit: dayclick believe you're looking for.

database - Why not set the value of Spinner Android. i use Cursor? -

i have table in database called primarydata includes fields primarydataid , primarydatacode .my problem is,when cursor returns data database , spinner not set values of cursor . xml spinner file <?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" android:textsize="14sp" android:textcolor= "#000000" android:spinnermode="dialog" /> primarydata class in put primarydataid , primarydatacode. class equivalent of database table. package com.example.proposaldashborad; public class primerydata { private int primerydataid; private string primerydatacode; @override public string tostring() { return this.primerydatacode; // display in spinner list. } public int getprimary

javascript - Wordpress plugin ajax returns 0 -

i'm trying send ajax data wordpress table can php 0 . on admin side. can me? also of code inside plugin-admin.php file inside plugin folder. <?php if ( ! defined( 'abspath' ) || ! current_user_can( 'manage_options' ) ) exit; global $wpdb; global $wp_version; $results = $wpdb -> get_results( " select id, post_title, post_excerpt $wpdb->posts post_type = 'post' , post_status not 'auto-draft' , post_title not 'auto draft' , post_status = 'publish' order post_title " ); add_action( 'wp_ajax_featured_submit_action', 'featured_submit_callback' ); function featured_submit_callback(){ echo "hi"; wp_die(); } ?> <div class="wrap"> <h2>select posts</h2> <select id="selected-p

arrays - Converting JSON data into a ColdFusion struct -

the following code have works treat. taking data sql database table , outputting structure below within cfc, output called mobile app, , code works required. <cfset currentrow=1> <cfloop query="lt_customers"> <cfset tempdata = structnew()> <cfset tempdata["imei"] = lt_customers.imei[currentrow]> <cfset tempdata["id"] = lt_customers.id[currentrow]> <cfset tempdata["name"] = lt_customers.last_name[currentrow]> <cfset tempdata["model"] = lt_customers.model[currentrow]> <cfset tempdata["trackee"] = lt_customers.trackee[currentrow]> <cfset tempdata["mobile"] = lt_customers.mobile[currentrow]> <cfset tempdata["app_user_mobile"] = lt_customers.app_user_mobile[currentrow]> <cfset arrayappend(result, tempdata)> <cfset currentrow=currentrow+1> </cfloop> <cfreturn result> </cffunction> i have data coming webservice

javascript - Dual Y axis line chart in d3.js without external data -

i new d3 (and javascript , html), please bear me. overall goal implement d3 charts within filemaker pro (fmp - relational database) , in particular mobile counterpart filemaker go. because charting options within fmp limited. fmp provide web viewer can render url's, or html , javascript code stored locally without needing internet connection. have replicated examples provided on d3 site, , wish replicate example without having resort external csv file: http://bl.ocks.org/d3noob/e34791a32a54e015f57d i have replicated above example in browser using external csv file, not yet in fmp. i have attempted follow other examples data embedded within d3 code, without success. fmp allows me to undertake calculations/text substitutions structure data in "correct" format , insert within d3 code, allowing chart update dynamically. applies d3 libraries. have applied to: http://bl.ocks.org/brattonc/5e5ce9beee483220e2f6 based on d3noob example above, , reading on how "in

r - Variance with vlm probit -

i implementing model logit. how can variance of data measure if prediction variance of data measure if prediction enter code here or not? m <- glm(a~ f+ en*rt, family = binomial(link = "logit"),data=df)` i read can did this, using confidence intervals: p <- predict(m, newdata=df, type="link",se.fit = t) critval <- 1.96 ## approx 95% ci upr <- p$fit + (critval * p$se.fit) lwr <- p$fit - (critval * p$fit) fit <- p$fit mean(((upr-fit)/1.96)^2, na.rm=t) but values huge. appreciate help.

vba - The MacScript function is not working well in Office for Mac 2016! Any ideas? -

my macros use macscript heavily, doesn't seem working in of latest office mac 2016 preview builds the macscript command, used support inline apple scripts in office mac 2011, being deprecated. due restrictions of sandbox, macscript command can no longer invoke other applications such finder. therefore discourage use of command. cases require changing existing code doesn’t use macscript , can use applescripttask command (see below). the new applescripttask command executes applescript script. similar macscript command except runs applescript file located outside sandboxed app. call applescripttask follows: dim myscriptresult string  myscriptresult = applescripttask ("myapplescriptfile.applescript", "myapplescripthandler", "my parameter string") where: the “myapplescript.applescript” file must in ~/library/application scripts/[bundle id]/, extension applescript not mandatory, .scpt

formatted input - What's the C++ version of scanf? -

for example... char* foo; scanf("%[^\n\r]", foo); how can in c++, without including c libraries? the equivalent have posted [aside fact char *foo without allocation of memory, lead writing either null or random location in memory] be std::string foo; std::getline(std::cin, foo); but more complex cases, read multiple items, either cin >> x >> y >> z; or std::getline(std::cin, str); std::stringstream ss(str); ss >> x >> y >> z; - or combination thereof. but c-code valid valid in c++ too. it's not "right" solution, not wrong either.

Java out of memory -

i have class named cachedownloader client downloads unzips updates main jar, client. had problem because couldn't unzip new client , replace while in use, had make new jar (named clientupdater) unzip new client replace old, open new one. clientupdater opens client no problem. cachedownloader cannot open clientupdater, gets out of memory error. cachedownloader still downloads new files , unzips brunt of files, clientupdater unzip tiny zip file contains small client. here how cachedownloader loads clientupdater: runtime.getruntime().exec("java -jar " + getcachedir() + "/clientupdater.jar"); system.exit(0); here full error message - http://gyazo.com/8105ffd4c35f5f6d4a68a770fedf8f92 hopefully enough context , information without being lengthy. question is, how can go fixing this? error says can increase reserved code cache, there negative side this? , how do anyway, google didn't show how explained did. i'm pretty new java keep in mind.

php and mysql database not working when i do search -

i having problem php code. have created database id int(11) not null auto_increment, isbn varchar2 not null, title varchar2 not null, author varchar2 not null, publisher varchar2 not null, year date not null, primary key (`id`) i have list of books in mysql database: isbn: 0763754891 title: web development javascript , ajax illumination author: richard allen, kai qian , lixin tao, xiang fu publisher: jones& bartlett date: 2009 isbn: 9780763754204 title: software architecture , design illuminated author: kai qian, xiang fu, lixin tao, jorge diaz-herrera,chong-wei xu publisher: jones & bartlett date: 2009 isbn: 0763734233 title: java web development illuminated author: kai qian, richard allen, mia gan,bob brown publisher: jones & bartlett date: 2007 isbn: 0471644463 title: component oriented programming author: andy wang, kai qian publisher: wiley date: 2005 isbn: 9781441906052 title: embedded software development c author: kai qian,

sharepoint 2013 - Access Web App - How to update UI after changing data through data macro? -

Image
let's assume have access web app 3 tables: group, person , task if using normal access client database: in app, data macros run whenever task table changed. if example new task added , person assigned it, workload field of assigned person increased estimated workload of task. similar changes performed if task entries changed or removed. since question related user interface, give details ui: the view group contains "related items" control displaying group members. "related items" control allows open popup selected person. this popup - again - contains "related items" control displaying assigned tasks. and actual problem: if edit estimated workload of task, changes in person entry stored in database - not reflected on user interface until manually reload web page. therefore question boils down to: how can make sure that changes, caused on person table data macros of task table, reflected on user interface without having reload

multiple item xml parsin in android -

my xml this: <?xml version="1.0" encoding="utf-8"?> <menu> <item> <id>1</id> <name>margherita</name> <cost> <p>155</p> <p>255</p> <p>355</p> <p>455</p> </cost> <description>single cheese topping</description> </item> <item> <id>2</id> <name>double cheese margherita</name> <cost> <p>900</p> <p>155</p> </cost> <description>loaded cheese</description> </item> <item> <id>3</id> <name>fresh veggie</name> <cost> <p>335</p> </cost> <description>oninon , crisp capsicum</description> </item> in cost tag have other tags i'm trying parsing xml this: xmlparser

python - Addressing a user details when my consumer class has one to one relation with User model -

in application have created consumer class keeps data in django user class , adds other characteristics in fields create me. consumer class connected user in 1 one relationship. able post data. but need search , retrieve information based on username received in request. not able search consumer class based on username . please advise how achieve this. my code given below class consumer(models.model): user= models.onetoonefield(user) company=models.charfield(max_length=64) street1=models.charfield(max_length=64) street2=models.charfield(max_length=64) city=models.charfield(max_length=64) state=models.charfield(max_length=64) country=models.charfield(max_length=64) i trying record below def user_page(request, username): consumer=get_object_or_404(consumer, username=username) # locate record i following error cannot resolve keyword 'username' field i tried user.username=username well.

reactjs - Passing an element vs. a react class to an optionally displayed modal -

i have table cell user can click on launch react-bootstrap modal displays additional details. modal displays component has own state , may trigger action pull data back-end if store doesn't have data needs. currently i'm passing component react element react-bootstrap's overlaymixin show details in modal i'm wondering if instead should passing react class , rendering react.createelement. current code: var mycell = react.creatclass({ _renderdetails: function () { return (<details id={this.props.id}/>); render: function() { return ( <td> <mymodal modal={this._renderdetails()}> {this.props.value} </mymodal> </td> ); } }); var mymodal = react.createclass({ props: { content: react.proptypes.element.isrequired } mixins: [overlaymixin], // called overlaymixin when component mounted or updated. renderoverlay: funct

Is there any option in google map sdk to display the scale bar option in the bottom of google map in IOS? -

Image
is there option in google map sdk display scale bar option in bottom of google map in ios? sample project given google not displaying mas scaling. need set yes or no api using google mp sdk display map scaling ios? screen shot attached i not sure in google map sdk, apple mapkit provides span can calculate using delegate method. if can same using google map sdk, should work. - (void)mapview:(mkmapview *)mapview regiondidchangeanimated:(bool)animated { mkcoordinatespan mapspan = mapview.region.span; nsstring * mapscalestring = [nsstring stringwithformat:@" 1 = ~110 km -> %f = ~ %f km", mapspan.latitudedelta, mapspan.latitudedelta*110]; self.mapscalelabel.text = mapscalestring; }

How to Convert Ruby UTF String -

i have string data, looks this: "\x00m\x00o\x00d\x00e\x00l\x00" when run: puts "\x00m\x00o\x00d\x00e\x00l\x00" i see like: 'model' but understand, string still encoded differently. puts seems apply translation. i'd convert "\x00m\x00o\x00d\x00e\x00l\x00" 'model' use elsewhere, strangely encoded string doesn't work me. anyone know way this? i've searched eyeballs out. so solution came to, helped come this: encoding_options = { invalid: :replace, undef: :replace, replace: '', universal_newline: true } data.gsub("\x00", '') .encode(encoding.find('ascii'), encoding_options)

C++ POW(X,Y) X negative double and Y negative double, gives nan as result -

i'm trying simple operation, pow(-0.89,-0.67) in c++ 14 code, , gives nan result. when doing same in scilab result -1.08. there way in c++ right result? i guessing made typo in scilab. must have written -0.89 ^ -0.67 which means did -(0.89 ^ -0.67) = -(1.08). if instead typed (-0.89) ^ -0.67 you have gotten answer -0.5504 - 0.9306i. negative root of negative number complex, , pow function in c++ give nan result. if use std::complex type, correct answer of -0.5504 - 0.9306i: #include <iostream> #include <complex> #include <cmath> int main() { std::complex<double> a(-0.89), b(-0.67); std::cout << std::pow(a,b) << std::endl; } output: (-0.550379,-0.93064)

How to make a part of jpg clickable in android -

image link as in example image. want use image background , want portion of image building , towers clickable open new activity in app. you can achieve mapping image , comparing click rect areas mapped image. after mapped (probably directly on code) have onclicklistener this: public void onclick(motionevent v){ for(pair<rect,actionlistener> areas : mappedareas) if(areas.first.contains(v)) areas.second.onclick(v); } ps: have problems absolute values on different screen sizes (if component allows fit_screen) should map relative coordinates (percentage) , convert absolute values before comparing.

c++ - Error when overloading insertion (<<) and addition (+) -

i'm learning c++ , baffling me. have vector class plus , insertion operators overloaded: #include <iostream> class vector { public: vector(float _x, float _y, float _z) { x = _x; y = _y; z = _z; } float x, y, z; }; vector operator+(const vector &v1, const vector &v2) { return vector(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); } std::ostream &operator<<(std::ostream &out, vector &v) { out << "(" << v.x << ", " << v.y << ", " << v.z << ")"; return out; } int main() { vector i(1, 0, 0); vector j(0, 1, 0); std::cout << i; /* std::cout << (i + j); */ } when try print vector fine: vector i(1, 0, 0); std::cout << i; // => "(1, 0, 0)" adding vectors works fine also: vector i(1, 0, 0); vector j(0, 1, 0); vector x = + j; std::cout << x; // => "(1

Need to move lots of consistently named files to certain folders (Windows 7) -

i need populate bunch of folders files of various types. the destination folder structure follows year > committee_name year > year month committee_name ex: 2015 > adp 2015 > 2015 january adp the files moved in folders committee (mom, adp, etc.). have organize first year, committee, month. each folder contains files of various types named date , committee (ex: word document adp meeting of jan 22, 2015 "012215adp.doc"). i somehow automate populating of these folders there hundreds if not thousands of files move. my programming experience in matlab, proficient in, not allowed use due corporate rules. i know how execute , modify .bat files, not know enough make them. @echo off setlocal enabledelayedexpansion set "destination=c:\path\that\contain\destination\folders" rem change current folder 1 contain mom, adp, etc. folders cd "c:\path\to\committees\folder" rem create array of month names (i.e. month[01]=january

objective c - iOS how to programmatically read device's screen auto-lock timeout time? -

Image
i'm creating method send debug info support team 1 of apps. have method calls these: nsstring* appversion = [[nsbundle mainbundle] objectforinfodictionarykey:@"cfbundleshortversionstring"]; nsstring* build = [[nsbundle mainbundle] objectforinfodictionarykey:@"cfbundleversion"];; nsstring* iosversion = [[uidevice currentdevice] systemversion];; an additional requirement understand how our internal timeout interacts device's screen auto lock timer. need compare our internal timeout ipad screen lock timer. is there way device's auto-lock time defined in device settings? see screen below number i'm trying read this isn't possible. following link has work around this. can idle time in app till screen goes off should same device' auto-lock time. iphone-detecting-user-inactivity-idle-time-since-last-screen-touch

mysql - Python MySQLdb "INSERT INTO" Issue -

my code attempts iterate through dictionary, "dbmap", , execute mysql insert statements based on keys , values of dbmap: for key in dbmap: try: cursor.execute("insert '%s' (id, additional_details) values (123, '%s')", (key, dbmap[key])) except unicodeencodeerror: pass i following error when run above code: _mysql_exceptions.programmingerror: (1064, "you have error in sql syntax; check manual corresponds mysql server version right syntax use near '''random_key'' (id, additional_details) values (123, 'random_value' @ line 1") i don't see mysql syntax i'm violating, following following resources help: http://www.mikusa.com/python-mysql-docs/query.html http://www.w3schools.com/sql/sql_insert.asp update:when try this: for key in dbmap: try: cursor.execute("insert {} (id, additional_details) values (123, '{}')".format(key, dbmap[key]))

javascript - How to check validation on fields , selected values can not be same? -

i have check validation on 2 fields ng-change. selected values cannot same have implemented below logic function not being called. been hours , cannot figure out doing wrong. please check if logic being implemented correctly. so far tried code.... main.html <div class="panel-body"> <form name="addattesform" id="addattesform" novalidate k-validate-on-blur="false"> <div class="row"> <div class="form-group col-md-6"> <label for="roletype" class="col-md-4">role type:</label> <div class="col-md-8"> <select kendo-drop-down-list data-text-field="'text'" data-value-field="'id'&quo

html - <div> height percentages not working -

i've got bunch of nested divs (i know, not ideal use, it's temporary solution). i'm trying make child divs different heights percentage, it's not working; divs expanded minimum height needed fit text. <div class="funnel" style="width:100%; height:600px"> <div class="container-header"> <p class="header"> funnel times </p> </div> <div class="outer" style="width: 100%; height:600px"> <div class="innercontainer" style="width: 50%; height:600px; float: left"> <center> <div class="signups-indie inner" style="width: 80%; height: 10%; background-color: #bfccd5"> <p class="funneltimestext"> sign-ups: 8 hours / 2.1% </p> </div> <div class="installs-indie inner" style="width: 80%; height: 10%; background-color: #9eb2be&

mysql - Why is an index not used on a LIKE query with wildcards? -

this question has answer here: optimization of mysql search using “like” , wildcards 4 answers how speed select .. queries in mysql on multiple columns? 5 answers although title column added index using following query: alter table recipe add index title_idx (title) mysql doesn't use index query: select * recipe title '%cake%'; i used explain keyword , key field null . how solve it? have improve query. you need full-text index match partially. consider normal index phone book: it's great finding people last name first name, "smith, john", useless finding people "ith" in name, you'll have go through entry entry manually matching. any query says like '%x%' automatically table scan. not scale non-trivial sized

How to find source code of Perl module using XSLoader? -

i view source code of i18n::langinfo . if go metacpan.org can find source @ https://metacpan.org/source/rjbs/perl-5.22.0/ext/i18n-langinfo/langinfo.pm but wrapper calls xsloader::load(); . if type perldoc -l i18n::langinfo /usr/lib/x86_64-linux-gnu/perl/5.20/i18n/langinfo.pm same file on metacpan.org, , there no other files in directory either. where source code located? in distribution: langinfo.xs . no use installing source! i18n::langinfo's langinfo exposes c function nl_langinfo .

javascript - AngularJs "ng-repeat-start" with table -

i have object in format, trying print table. [{categoryname: "category1", value:[{name:"item1.1"}{name:"item1.2"},...]}, {categoryname: "category2", value:[{name:"item2.1"},...]},...] so, categaory name should header , values under should subheaders, in colspan of categoryname should equal number of values in it. <table> <thead> <tr ng-repeat-start="obj in hobj"> <th ng-repeat="val in obj.value">{{val}}</th> </tr> <tr ng-repeat-end></tr> </thead> </table> the above code print each value of array different " tr ". how can achieve it? edit data: sorry, data flattened think.. [{categoryname: "category1", value:["item1.1","item1.2",...]}, {categoryname: "category2", value:["item2.1",...]},...]

java - Making 2 dynamic TextViews not overlap -

i have been working on app shows statuses server. have cardview each server, relativeview inside. on left image, aligned cards left. in middle, have textview, aligned image right. on right, have textview, aligned right of card. basically, issue is, without using linearlayout, how can make middle textview not overlap right textview, preferably in layout's xml? text in both views dynamically long, making linearlayout not preferable. here diagram of layout picture i'm talking about. sorry external link, getting reformatted in post. i figured out how programatically. simply, want subtract widths , padding of surrounding views size of container view, , set leftover value text view's width. here example: int view_length = personviewholder.container.getwidth() - personviewholder.container.getpaddingstart() - personviewholder.container.getpaddingend(); view_length = view_length - personviewholder.object_to_left.getwidth() - personviewholder.object_to_lef

Custom iOS Floating Button -

i've been looking around on internet , there doesn't seem in way of conversation (or i'm asking wrong question - i'm new @ objective-c , ios both) creating custom assistive touch-like button in ios. i access app launcher application , float button let me go said launcher anywhere in app. floating assistive touch button scheme seems perfect - has made that? [edit] in response meaningful questions - wasn't clear enough (again, apologies - inexperienced here). i have 3 apps: app gatherer, app target 01, app target 02. app gatherer able launch multiple apps via url. once that, , new app opens, i'm wondering if can have floating button can moved around , clicked seperate ui of target app assistive touch button. purpose of floating button me out of target apps - it's totally separate - gatherer app. i don't have implementation - i'm trying map out , see if it's possible. in wrong place ask that? when u open app using url appgat

.net - Consuming SSL SOAP Service, could not establish secure channel for SSL/TLS -

i'm working on windows mobile 6.5 pro application, using .net compact edition 3.5 . i'm able contact standard web service (not using ssl), https won't go through. i've attempted add web reference ; 1 pointing https version. assuming generate proper code ssl, nothing. every time attempt communicate service via code following: an existing connection forcibly closed remote host. not establish secure channel ssl/tls. i tested same code on .net 4.5 console app , able reach https web service , xml response without issues. it appears generated web refence on vs2008 https missing something? there's not code show here besides auto-generated code vs2008 produces when add new web reference. update 1: i've been following post appears same issue i'm encountering sadly don't think resolved. how can establish secure channel ssl/tls handheld device? update 2: after more research, windows mobile 6.5 pro appears support tls v1.0 while soap

mapreduce - how to get the average number of words in a text in mrjob? -

im stuck simple problem in mrjob mareduce framework: want average number of words in given parragraph , got this: class lineaverage(mrjob): def mapper(self, _, line): numwords = len(line.split()) yield "words", numwords yield "lines", 1 def reducer(self, key, values): yield key, sum(values) with code, after reduce process, total of lines , words in text, dont know how average doing: words/totaloflines i newbie in model of programming, if can illustrate example it'll appreciated. in meantime, thank attention , participation after all, answer simple: sended reducer number of values equal number of lines. so, in reducer had count numer of values key. class lineaverage(mrjob): def mapper(self, _, line): numwords = len(line.split()) yield "words", numwords def reducer(self, key, values): i,totall,totalw=0,0,0 in values: totall += 1 totalw += yield "avg", totalw

c# - Regular expression for 0 or a positive number -

i need regular expression check string's value either '0', or positive number length equal 1 10 (also first digit cannot zero). i'm stuck, can 0, can't positive number. here have: (^([0])$)|(^([1-9][0-9]{0-9})$) this reg exp looks little crazy, i've been trying lot of different things , making more crazier , crazier. for range of possibilities, use comma, not hyphen. (^([0])$)|(^([1-9][0-9]{0,9})$) however, regex can shortened to: ^(0|[1-9][0-9]{0,9})$

java - Calendar dont work as expected -

i using calendar api think wrong calendar cal = new gregoriancalendar(timezone.getdefault()); cal.add(calendar.year, 2015); cal.add(calendar.month, 6); cal.add(calendar.day_of_month, 20); cal.add(calendar.hour, 19); cal.add(calendar.minute, 0); log.d("tag", cal.gettime().tostring()); why value? d/tag﹕ thu jan 09 13:24:24 cest 4031 by using add , getting calendar instance 2015 years, 6 months, 20 days, , 19 hours later now. instead use constructor : calendar cal = new gregoriancalendar(2015, 5, 20, 19, 0); and not call add . alternatively, can use set instead of add: cal.set(calendar.year, 2015); cal.set(calendar.month, 5); // 0-based cal.set(calendar.day_of_month, 20); cal.set(calendar.hour, 19); cal.set(calendar.minute, 0);

python - How to display game on the screen? -

i'm trying make kivy app starting menu, can't display pong game on second screen. how should refer game make visible? tried , searched can't find anything. i'm 100% sure ponggame work corectly, can't display it. great if show me how corectly. main.py: from kivy.app import app kivy.uix.screenmanager import screenmanager, screen, wipetransition kivy.properties import objectproperty kivy.uix.widget import widget kivy.properties import numericproperty, referencelistproperty,\ objectproperty kivy.vector import vector kivy.clock import clock kivy.uix.popup import popup kivy.uix.label import label class pongpaddle(widget): score = numericproperty(0) def bounce_ball(self, ball): if self.collide_widget(ball): vx, vy = ball.velocity offset = (ball.center_y - self.center_y) / (self.height / 2) bounced = vector(-1 * vx, vy) vel = bounced * 1.1 ball.velocity = vel.x, vel.y + offset class

c# - Find string with RegEx by prefix and segments -

we trying write program stores variables, parameters, methods, classnames etc. of project. replace methods right names. using directory.getfiles() , streamreader read out .cs files. let's following result got reading out .cs files: string code = @"public static void _met_classname_methodname() { var _var_methodname_foo = \"test\"; }"; in reality string code way longer , contains more method , variable definitions. in end going add parameters , class names. i trying method , variable name regex although nothing worked , have no idea how achieve trying. symbol names consist of following: _abc_segment1_segment2 . abc can 3-letter value, segment1 , segment2 contain alphanumeric characters (the length of segments variable) , underscores there. i tried reading on regex , used regexr.com "try out" although never got far. appreciated. the following tried: /_met_([a-z]\w+)/g this isn't variable due having _met_ in there fixed , doesn&#

parse.com - Is iOS Data Protection compatible with the Parse local datastore? -

apple offers data protection capability apps encrypts data stored on device when device locked. parse ios local datastore apparently stored unencrypted sqlite database . possible apply required data protection attributes local datastore, nsfileprotectioncomplete ? parse ios docs don't this. i have applied appropriate clps , acls parse classes/objects. i'm looking ios data protection if user's phone lost or stolen , device passcode in place, data inside local datastore cannot read.

android - Using UiAutomation from an accessibility service -

i writing accessibility service android aims @ providing different alternatives people physical disabilities control device, instance, using switches, scanning, head tracking, , others. currently, perform actual actions on application's interface use accessibility api, accessibilitynodeinfo.performaction() method. works fine of time, found important restrictions: most keyboards (ime) not work. had success google keyboard on lollipop (api 22) , had use accessibilityservice.getwindows() . lower api versions had develop special keyboard (undoubtedly not optimal solution). most games not accessible. dot. not export accessibilitynodeinfo tree. web navigation not practical (no scrolling, among other issues). a solution use different api perform actions, , seems android.app.uiautomation fit purpose. according documentation "it allows injecting of arbitrary raw input events simulating user interaction keyboards , touch devices" looking for; although understand uiaut