Posts

Showing posts from May, 2011

protractor - Accessing Iframe inside Iframe -

i working on angular app, runs inside non-angular page. on angular page, have iframe(iframe2) inside iframe(iframe1). able move iframe1 non angular page, not able access iframe2 iframe1 throws error "angular not found on window" it('iframes testing',function(){ brower.driver.navigate().to('url') browser.driver.ignoresynchronization = true; browser.driver.findelement(by.id('username_str')).sendkeys("username"); browser.driver.findelement(by.id('password')).sendkeys("password"); browser.driver.findelement(by.name('submit')).click(); browser.driver.ignoresynchronization = false; browser.driver.switchto().frame(0); browser.waitforangular(); browser.driver.switchto().frame(0); element(by.model('formname')).click(); });

python - PyQt4: How to auto adjust size of a widget not in layout -

Image
i want implement gui program blueprint editor in unreal game engine pyqt4. here example of blueprint editor: first create simple container widget place components(the rectangles). in order allow user place rectangles wherever want(by drag & drop), can't place widgets in layout. when content of rectangle changed, rectangle widget can't auto adjust size itself. following example code: import sys pyqt4 import qtcore pyqt4 import qtgui class changeablechild(qtgui.qwidget): def __init__(self, parent=none): super(changeablechild, self).__init__(parent) self.setlayout(qtgui.qvboxlayout()) def addwidget(self, widget): self.layout().addwidget(widget) class mainwidget(qtgui.qwidget): def __init__(self, child, parent=none): super(mainwidget, self).__init__(parent) child.setparent(self) def main(): app = qtgui.qapplication(sys.argv) changeable_child = changeablechild() button = qtgui.qpushbutton("ad

sqlite - How to make an pdo_sqlite connection from binary stream in PHP -

having .sqlite file in memory stream (php://memory), want pipe pdo_sqlite driver create connection. possible? its testing purposes, want recreate dbs without recreate schema @ each time nor using tmpfs. in memory sqlite has limitations. memory space request, session, no way seems documented share base in memory among users. for request, open base code $pdo = new pdo( 'sqlite::memory:'); and base disapear on next request. for session persistency <?php $pdo = new pdo( 'sqlite::memory:', null, null, array(pdo::attr_persistent => true) ); ?> also read manual

javascript - Very slow BrowserSync server startup with Gulp -

[ edit: solved! ] see answer below. [>> original question follows <<] i'm using browsersync in server mode (using built-in static server) gulpjs on local project, , seems working correctly except browsersync server slow startup. browsersync seems initialize right away when run gulp, takes 4 5 minutes (and more) server start , return access urls. during period, continues run , browsersync responds reload() calls , such, access not available via usual urls (in case, localhost:3000 , localhost:3001). once access urls returned, server has seemingly started , browsersync's page refreshes work fine , speedy. i have tried several different configurations of gulpfile.js, trying different ways initialize browsersync, different approaches calling stream() , reload() methods (including trying browsersync's basic gulp/sass "recipe"), , different port numbers, configurations had same problem. tried disabling firewall , av software (avast), nothing. i&

mocking - JMS Queue testing with spock -

i using activemq , trying send , whether possible test if own created mock sent message queue. using activemq & want automate test where, mock send message queue , spock make sure message has been sent. you can first create queuebrowser , using enumeration number of messages. let loop run till enumeration object has elements. check message in loop, if there. code should somehow looks this queuebrowser qbrowser = session.createbrowser(queuename); enumeration messages = qbrowser.getenumeration(); while (messages.hasmoreelements()) { textmessage message = (textmessage) messages.nextelement(); string a=message.gettext(); if (message there) { return true; } } cheers :)

c++ - Member is inaccessible -

Image
class example{ public: friend void clone::f(example); example(){ x = 10; } private: int x; }; class clone{ public: void f(example ex){ std::cout << ex.x; } }; when write f normal function, program compiles successful. however, when write f class member, error occurs. screenshot: the error you're seeing not root-cause compilation error. artifact of different problem. you're friending member function of class compiler has no earthly clue exists yet,much less exists specific member. a friend declaration of non-member function has advantage acts prototype declaration. such not case member function. compiler must know (a) class exists, , (b) member exists. compiling original code (i use clang++ v3.6), following errors actually reported: main.cpp:6:17: use of undeclared identifier 'clone' main.cpp:17:25: 'x' private member of 'example' the former direct cause of latter. doing this inst

Scala: parse MIME/multipart raw emails over HTTP one at a time -

i'm trying parse raw email messages on http 1 @ time come in mime/multipart. here chunk of 1 of mails, mail code threw exception on java.nio.charset.malformedinputexception: input length = 1 and here (i think) relevant chunk of mail: content-type: multipart/alternative; boundary="------------000401070001090809020709" --------------000401070001090809020709 content-type: text/plain; charset=windows-1252; format=flowed content-transfer-encoding: 8bit is there scala library out there handling type of input? otherwise there easy way write code handles it? i've been looking @ mime4j , scala code in particular. as of now, code uses scala.io.source.fromurl scrape raw mail follows: scrape(scala.io.source.fromurl(url)) which turns bufferedsource string , splits it: source.mkstring.split("\n\n", 2) i've tried using implicit codec since scala.io.source.fromurl can take codec: implicit val codec = codec("utf-8") codec.onm

asp.net mvc - Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0 -

i developing web application uploading file on google drive. whenever execute connect method throw error. i have tried like. http://wordpress.kjetil-hartveit.com/2014/06/04/google-api-nightmare-how-i-fixed-the-could-not-load-file-or-assembly-system-net-http-primitives-version1-5-0-0-exception/ error showing in downloaded dll powershell cmdlet missing assembly google api but still nothing working. <!-- snippet web.config --> <dependentassembly> <assemblyidentity name="system.threading.tasks" publickeytoken="b03f5f7f11d50a3a" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.6.9.0" newversion="2.6.9.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.net.http" publickeytoken="b03f5f7f11d50a3a" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.2.22.0" newversion="2.2.22.0"

php - MS SQL, invalid object name -

okay, let me make short, can delete whole row database using code: $sql = "delete [master].[dbo].[testtbl] agent_id = '{$_session["agentid"]}' "; but when try: $sql = "delete username [master].[dbo].[testtbl] agent_id = '{$_session["agentid"]}' "; i tried make [name], still invalid object name username... i want delete username of agent_id appreciated. :d delete username [tablename] ^ you cant delete 1 column using delete command. have delete whole row delete [tablename] want delete username of agent_id you can use update command change information update [tablename] set username=null agent_id=1 // or whatever value

Ada - getting string from text file and store in array -

hi im wondering how put data in array if loop txt , store in a_composite name. procedure main type an_array array (natural range <>) of a_composite; type a_composite record name : unbounded_string; end record; file : ada.text_io.file_type; line_count : integer := 0; begin ada.text_io.open (file => file, mode => ada.text_io.in_file, name => "highscore.txt"); while not ada.text_io.end_of_file (file) loop declare line :string := ada.text_io.get_line (file); begin --i want store line string array. don't know how end; end loop; ada.text_io.close (file); end main; ok, have unconstrained array here. has implications; see unconstrained array gains definite length when object (general sense, not oop) declared or initialize

Custom value change listener in android? -

need or advice. aim continuous updates method android.telephony.cellsignalstrengthwcdma.getdbm() (get mobile network signal strength dbm) , make update of correspondent text view when value provided method changes. the first approach of solution request value in do-while cycle predefined time interval, 1 second, check difference between common , previous values , make decision of textview update. so question maybe there other better way this, using kind of system listener etc? br, you need add phonestatelistener telephonymanager using proper method listen(). need pass sub class of phonestatelistener , event want get. example can listen phonestatelistener.listen_cell_info; in case method oncellinfochanged (list cellinfo) of phonestatelistener called, providing info need, avoiding loop.

bash - How to use ~/.bashrc aliases on IPython 3.2.0? -

i need use aliases ~/.bashrc on ipython. first i've tried didn't work %%bash source ~/.bashrc according this post should %%bash . ~/.bashrc f2py3 -v it takes 20 sec run on jupiter , get: bash: line 2: f2py3: command not found my ~/.bashrc file looks like alias f2py3='$home/python/bin/f2py' bash: line 2: type: f2py3: not found neither alias, source, nor %rehashx% work %%bash alias f2py3='$home/python/bin/f2py' i found problem python, can't execute alias command neither sh nor bash. can use alias ipython magics? you can parse bashrc file in ipython config , add custom aliases have defined: import re import os.path c = get_config() open(os.path.expanduser('~/.bashrc')) bashrc: aliases = [] line in bashrc: if line.startswith('alias'): parts = re.match(r"""^alias (\w+)=(['"]?)(.+)\2$""", line.strip()) if parts:

osx - Phonegap installation fails using npm -

Image
i followed up , running phonegap on mac osx on every single step got stuck i have tried many solutions , fixes still nothing working. followed this answer still stuck. what cause these issues?! update1: when install cordova using sudo npm install -g cordova following: even when type cordova, -bash: cordova: command not found update2: i fixed cordova installation using following steps: sudo chown -r $user /usr/local sudo chmod -r 0775 /usr/local add path using this answer add path bash_profile using this link open terminal , type cordova -v , working displaying version phonegap still failing , can't seem find fix it

java - Where to start when trying to retrieve data with requests and responses coded in XML and HTTP is the protocol -

to start, newbie programmer , have taken on summer job after finishing first year in college year. have been asked write code program requests , responses coded in xml. have been told requests made via post command , both request parameters , responses carried out in body of http sent , received specific url. have been given command format example: <?xml version="1.0" encoding="utf-8"?> <cmd action="read_val" user="username" password="*****"> <val cid="0" node="1" vid="100" set="5" nodetype="16"/> </cmd> i have searched high , low , have found loads of different information on topic there technical me @ moment. need 'baby steps' help. small company , there no other programmers ask questions , advice. i learning java in college , have used site many times , have found useful. can open sockets, bind sockets etc in java , read in da

reactjs - React Native - Call Function of child from NavigatorIOS -

i trying call child function right button on parent navigator. a basic code example of need follows: main.js <navigatorios style={styles.container} initialroute={{ title: 'test', component: test, rightbuttontitle: 'change string', onrightbuttonpress: () => ***i want call miscfunction here*** , passprops: { fbid: this.state.fbidprop, favspage: true } }}/> test.js class test extends react.component{ constructor(props){ super(props); this.state = { variable: 'some string' }; } miscfunction(){ this.setstate({ variable: 'new string' }; } render(){ return( <text> {variable} </text> ) } } this covered in following github issue: https://github.com/facebook/react-native/issues/31 eric vicenti comments describe how faceb

javascript - Fisher Yates shuffle 1 number shown -

i using fisher yates shuffle , gone through little tutorial, can see can randomize order such 4,1,3,2,6,7,5 etc... want find out how have 1 number shown. there submit button , when press submit random number between 1 7 shown. number put aside when hit submit again there 100% chance wont see number again. can press submit 7 times , 8th time nothing happen. javascript using: <script> array.prototype.shuffle = function(){ var = this.length, j, temp; while(--i > 0) { j = math.floor(math.random() * (i+1)); temp = this[j]; this[j] = this[i]; this[i] = temp; } return this; } var arr = ['a','b','c','d','e','f','g','h']; var result = arr.shuffle(); document.write(result); </script> i have googled no success, many thanks. here implementation of have used. function fisheryates ( myarray,stop_count ) { var = myarray.length; if ( == 0 ) return false; var c = 0; w

mysql - List users by program -

having tables these: users: create table `affiliate__model__user_node` ( `id` bigint(20) not null auto_increment, `user_id` bigint(20) default null, primary key (`id`) ) engine=innodb programs: create table `affiliate__model__program` ( `id` bigint(20) not null auto_increment, `name` varchar(255) not null, primary key (`id`), ) engine=innodb users using programs: create table `affiliate__model__user_program` ( `user_id` bigint(20) not null default '0', `program_id` bigint(20) not null default '0', `username` varchar(255) not null, primary key (`user_id`,`program_id`) ) how list users belonging particular program, this? user_id | program 1 | program 2 | program 3 | program n .... --------------+-----------+-----------+-----------+----------- 1 | y | n | n | y 3 | n | n | n | n 7 | n | y | n | n 12

java - how to use Example table (Parametrised Scenarios) with normal "Given" statement -

when trying run below story file, statement " a stock of " executing 2 time want execution should happen once , statement " reference data databasetable record sds id = , swift bic = " should execute twice. scenario: parametrised scenarios test given scenario parameter - swiftbic = jbehavexxx given scenario parameter - receiverbic = jbehaveyyy given scenario parameter - extsdsid = 1111 given scenario parameter - sdsid = 22222 given reference data databasetable record <alias> sds id = <sid> , swift bic = <bic> given stock of. examples: |alias |sid |bic | |def |${sdsid} |${swiftbic} | |deff |${extsdsid} |${receiverbic} | in cucumber using example s shortcut writing same scenario twice different data. code above equivilent to: scenario: test fisrt set of data given reference data databasetable record def sds id = 2222 , swift bic = jbehavexxx given stock of. scenario: test sec

r - dplyr summarise over nested group_by -

i have data frame this: date amount category 1 02.07.15 1 1 2 02.07.15 2 1 3 02.07.15 3 1 4 02.07.15 4 2 5 03.07.15 5 2 6 04.07.15 6 3 7 05.07.15 7 3 8 06.07.15 8 3 9 07.07.15 9 4 10 08.07.15 10 5 11 09.07.15 11 6 12 10.07.15 12 4 13 11.07.15 13 4 14 12.07.15 14 5 15 13.07.15 15 5 16 14.07.15 16 6 17 15.07.15 17 6 18 16.07.15 18 5 19 17.07.15 19 4 i calculate sum of amount each single day in category. attempts (see code) both not sufficient. summarise(group_by(testdata, category), sum(amount)) wrong output --> here sum calculated on each group category sum(amount) 1 1 6 2 2 9 3 3 21 4 4 53 5 5 57 6 6 44 summarise(group_by(testdata, date), s

html - Table width can't be set below 385 pixels and responsiveness issue -

i using bootstrap , have part in code is: <table class="table">...</table> in header, have tag <meta name="viewport" content="width=device-width"> works fine(i can see whole table on website) when add <meta name="viewport" content="width=device-width initial-scale=1"> suggested on many websites, table doesn't fit 320 px width viewport have been using test , have scroll see whole table. further investigation , playing around css .table shows can't manually set width below 385 px. have tried searching "bootstrap table 385 px" doesn't seem there special number wondering why table can't smaller. have ideas how can make table smaller or make scale correctly initial-scale=1? edit #1: <table class="table"> <thead> <tr> <th>col1</th> <th>col2</th> <th>col3</th> </tr> </thead>

OOP concept by destructors? -

which object oriented programming concept displayed destructors? example, overloading shows polymorphism. please explain reason answer. not find anywhere on web.. most of key oop concepts shown destructors. if consider concepts including inheritance , object , class , encapsulation , method , message passing , polymorphism , abstraction , composition , delegation , open recursion . can show of them being @ play in destructors generally. now, "destructor" means method defined in class automatically invoked when object destroyed*. covers method , object , class . destructors encapsulate clean-up logic. consider structure can point structure: struct somestruct { somestruct* next; } if above written in language didn't support object-oriented design letting define method on somestruct itself, , deletes heap objects global delete() method, clean all memory used somestruct we'd need like: cleanupsomestruct(somestruct* todelete) { while(todele

machine learning - Why does Neural Network give same accuracies for permuted labels? -

i have datset of 37 data points , around 1300 features. there 4 different classes , each class has around same number of data points. have trained neural network , got accuracy of 60% 2 hidden layers not bad (chance level 25%). the problem p-value. i'm calculating p-value permutation test. i'm permuting labels 1000 times , each permutation i'm calculating accuracy. p-value calculate percentage of permutation accuracies aver on original accuracy. for permutations of labels i'm getting same accuracy original labels, i.e. neural network not seem include labels in learning. if svm i'm getting permutations different accuracies (in end gaussian distribution). why case? by way, i'm using deeplearntoolbox matlab. is 60% success rate on training data or validation dataset set aside? if you're computing success rate on training data expect high accuracy after permuting labels. because classifier overfit data (1300 features 37 data points) , ac

if statement - PHP Conditionals: is_null($someVariable) vs. $someVariable === 0 -

i debugged problem had root mention down here: the first conditional true; second conditional not execute; why 2nd conditional not execute? $somevariable = 0; if ( $somevariable === 0 ) var_dump('worked'); if ( is_null($somevariable) ) var_dump('worked too'); i think saw working in 'legacy' code, not sure it. from is_null docs: returns true if var null, false otherwise. the second conditional doesn't execute because $somevariable isn't null.

java - run maven plugin goal on multiple modules -

so have many maven modules in project , i'd run 1 maven plugin's goal on multiple modules here's do: mvn -pl module1,module2,module3 wls:deploy unfortunately here's get: [info] ------------------------------------------------------------------------ [info] reactor summary: [info] [info] module1 ............................................... success [7.422s] [info] module2 ............................................... skipped [info] module3 ............................................... skipped [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 8.370s [info] finished at: thu jul 02 09:34:37 cest 2015 [info] final memory: 23m/301m [info] ------------------------------------------------------------------------ so problem maven skips modules after first one, , i'd goal fired on modules. this i'd ach

what does remaining_requests mean in the response of api requested travis ci build? -

subj. does mean in free account have limited number of api requests? example of part of response: { "@type": "pending", "remaining_requests": 9, "repository": { "@type": "repository", when sent first response, value 10. after second response - became 9... i think it's hourly limit. api code here . it says: time_frame = 1.hour limit = 10 ... def remaining_requests(repository) api_builds_rate_limit = limit(repository) return api_builds_rate_limit if access_control.full_access? count = query(:requests).count(repository, time_frame) count > api_builds_rate_limit ? 0 : api_builds_rate_limit - count end

Total from an expression in SSRS -

i have written expression , added calculated field: =iif(fields!date1.value the calculated field returns either 1 or 0. i want total of 1's, when try , total: =count(fields!totals.value = 1) totals every row in report, e.g. total counts 0's well. please can advise how get total of 1's? - e.g., sift out 0's? many thanks if understanding correct, sum operation. in tablix total field input expression "sum(fields!totals.value = 1)"

XML file download using Javascript Not working in IE -

am trying create xml file content , download it. wrote code this, /* preparing xml data*/ var xml=new xmlwriter(); xml.beginnode("root node"); xml.attrib("adib", "attribute"); xml.node("fullname", "anil"); xml.node("d.o.b", "31/12/2015"); xml.endnode(); xml.close(); /* downloading xml file*/ var data = xml.tostring().replace(/</g,"\n<"); var = document.createelement('a'); a.href= 'data:application/xml;charset=utf-8,' + encodeuricomponent(data); a.target = '_blank'; a.download = 'new.xml'; a.click(); it working in chrome not in ie. can please me. it's because of differences support of data urls in common browsers. can check compatibility here: http://caniuse.com/#feat=datauri . , far know, ie has limited ( https://msdn.microsoft.com/en-us/library/cc848897(v=vs.85).aspx ).

spring - How to handle multiple exceptions in @exeptionhandler and response body? -

should create method org.springframework.security.access.accessdeniedexception parameter? @controlleradvice public class accessdeniedexceptionadvice { private final logger log = loggerfactory.getlogger(getclass()); @autowired private errorresponsemapperservice errorresponsemapper; @exceptionhandler({ com.mycomp.myapp.platform.common.exception.accessdeniedexception.class , org.springframework.security.access.accessdeniedexception.class }) // <-- here have added exeption @responsestatus(value = httpstatus.forbidden) @responsebody public errorresponsedto accessdenied(com.mycomp.myapp.platform.common.exception.accessdeniedexception.class ex) { log.error("access denied", ex); return errorresponsemapper.createerrorreponsedto(null, "access denied", myapperrorcodesenumdto.my_app_unauthorized_exception); } }

Android studio module naming convention -

i looking thorough android studio module naming convention suggestion. if name of module app free best name convention that? app-free appfree app_free appfree there no convention android module names. but since packagenames lowercase , dot-separated, i'll used appfree . btw if want build "free" version of something, take @ gradle' flavors instead of modules.

SQL Server : append string not working if col is empty -

i need programatically append string col1 . below code works in case col1 not empty. if it's empty after running code remains empty. why? update table set col1 = col1 + ';somestring' col2 = rowid that's because operation null results in null . need use isnull() "transform" null values empty strings: update table set col1 = isnull(col1, '') + ';somestring' col2 = rowid

php - Trouble using a reusable database connector -

i'm new php. i've been having trouble connecting , using data php. don't have information on issue, maybe i'm using out of date method, or did wrong. i've double checked , looked on website information, didn't find much. here's code below. the error reads : fatal error: call member function query() on boolean in c:\xampp\htdocs\website\practice\mysqli\pdo.php on line 6 that mean there problem located near the $result = $conn->query($sql)or die(mysqli_error()); i entered username , password correctly. created new username , password make sure. have no other ideas why $conn isn't working, , love thoughts or ideas on issue! connection.ini.php function dbconnect($usertype, $connectiontype = 'pdo') { $host = 'localhost'; $db = 'student'; if ($usertype == 'read') { $user = 'user'; $pwd = 'pass'; } elseif ($usertype == 'write') { $

Check Whether person logged in is user or admin in sharepoint -

how check whether person loggen in user or admin checking permissions in sharepoint. you can use spservices determine permission levels user. can use below code in document.ready function. $().spservices({ operation: "getrolecollectionfromuser", userloginname: $().spservices.spgetcurrentuser(), async: false, completefunc: function(xdata, status) { $(xdata.responsexml).find("role").each(function() { alert($(this).attr('name')) });

c# - Do unnecessary curly braces reduce performance? -

after encountering while programming, have been wondering this. below 2 snippets both legal , compile. specifically, question this.. in second case, brackets make program slower? why allowed? 1st case: if (statement) { // } 2nd case: { if (statement) { // } } additionally if had code below.. runtime same calling function x without of curly brackets. { { { // call function x } } } most of time doesn't make difference - , should code readability more else. however, curly braces can have effect on performance, in surprising way, although it's pretty unusual. consider code: using system; using system.collections.generic; class test { static void fewercurlies() { list<action> actions = new list<action>(); (int = 0; < 100; i++) { int x; if (i % 3 == 0) { actions.add(() => x = 10); } int y

crosstab using php & mysql -

i have database table in format date_from  date_to   charge  amount ==================================== 01/01/15   07/01/15   agti     500 01/01/15   07/01/15   agtii    700.50 08/01/15   14/01/15   agti     330.19 08/01/15   14/01/15   agtii    540.19 now want display depending on date range given user charge  01/01/15-07/01/15        08/01/15-14/01/15          total ================================================================== agti     500                            330.19                          830.19 agtii    700.50                        540.19                         1240.69 ==================================================================== total    1200.50                        870.38                          2070.88 if user select 01/01/15-07/01/15 date calender 01/01/15-07/01/15 column , total value come , if select 01/01/15-14/01/15 column 2 weeks , t otal value display . badly stuck 1 please help..  this not complete sol

jquery - Very similar PHP code in two pages, one works, the other won't -

i'm building restaurant table-management system in php using bootstrap, jquery , mysqli. problem can't seem display query results on page despite code being very, similar in both, can please explain i'm missing please? full code of site far (site in spanish): <!doctype html> <head> <title>postodoro</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="screen" /> <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" /> <script language="javascript" type="text/javascript" src="scripts/jquery-2.1.4.min.js"></script> <script language="javascript" type="text/javascript" src="bootstrap/js/bootstrap.min.js"&

javascript - How can I tell why Meteor autorun is triggered -

i found tracker.autorun runs multiple times, , don't know why, there way find out reactive computation triggered autorun ? tracker.autorun(function(comp) { comp.oninvalidate(function() { console.trace(); }); // autorun code here });

oauth 2.0 - Android: Google OAuth2 Scopes Format -

tutorials , documentation google oauth2 login android inconsistent format , style of scopes used googleauthutil.gettoken. include scopes urls or words, include client id or not, , use android app, service account, or web app id? i'm trying now: string mscope="oauth2:server:client_id:xxxxxxxxxx:api_scope:https://www.googleapis.com/auth/plus.login" but throws googleauthexception: unknown error. if don't include client id access token, trying authenticate our backend django web app, 403: forbidden error. there's example @ https://github.com/googledrive/crossclientoauth2-android : final private string client_id = "abc123.apps.googleusercontent.com"; final private list<string> scopes = arrays.aslist(new string[]{ "https://www.googleapis.com/auth/plus.login", "https://www.googleapis.com/auth/drive" }); string scope = string.format("oauth2:server:client_id:%s:api_scope:%s", client_id, textutils.joi

Protractor AngularJS mouseOver field to reveal hidden buttons to click -

i new protractor. trying hover on field show hidden icons click on. there list of 'bookings'(sometimes 1 many) when hovered on reveals button edit or delete booking. having trouble filtering booking want hover on field reveal delete or edit buttons. <div class="list-view-container"> <div class="list-view-header"> <div class="col-sm-3 col-md-3 column-item" ng-click="bookingsctrl.changebookingsort(bookingsctrl.sortcolumns.postas)">booking name <span class="booking-icon" ng-show="bookingsctrl.bookingsort === bookingsctrl.sortcolumns.postas" ng-class="bookingsctrl.bookingsortreverse? 'icon-down':'icon-up'"></span> </div> <div class="col-sm-2 col-md-2 column-item" ng-click="bookingsctrl.changebookingsort(bookingsctrl.sortcolumns.startdate)">start date <span class="booking-icon" ng-show="boo

Matlab: Convert function handle to string preserve parameters -

any variables , values stored in function handle when created lost if convert function handle string , again using func2str , str2func functions. is there way overcome ? like y = 1; fun = @(x) x + y fun_str = func2str(fun); clear y fun = eval(fun_str); result = fun(12); % doesn't work concrete have measurement method creating data gets fitted (with of fminsearch ) against custom functions alignment procedure. store data future analysis. since data survives longer code, make independent source file. that's why convert function handle string. in string matlab builtin functions allowed called. now can of course store y in example. wondering if there more elegant solution not need this. the problem stems matlab storing value of y within workspace local anonymous function while keeping symbol y part of function definition. then, indicated, func2str function converts definition without replacing symbol value. since example indicates want function handl

sorting - Ember, run component method once when computed in controller has finished -

i'd call method once when computed in controller has finished. here controller : import ember 'ember'; export default ember.arraycontroller.extend({ sortproperties: ['id:desc', 'id:asc', 'value:desc', 'value:asc'], sortedstats: ember.computed.sort('model', 'sortproperties'), actions: { sortby: function(sortproperties) { this.set('sortproperties', [sortproperties]); } } }); a template : <div><button {{action 'sortby' 'type:asc'}}>asc</button><button {{action 'sortby' 'type:desc'}}>desc</button></div> <h1>chart</h1> {{chart-bar width=500 height=200 series=sortedstats}} and component : import ember 'ember'; export default ember.component.extend({ tagname: 'svg' draw: function() { // here draw chart }, init: function() { this._sup

which command is used to check if a button is enabled or disabled using selenium IDE. -

you can not click button unless edit @ least 1 field, , button disabled. once edit field button 'reset' enabled click. you can solve in number of ways. probably 1 of more useful ways (if using fact more once), save "status" of button variable. below 2 separate examples of how code this. the first example take variable called isselected, , assign either value of "block" or "none" dependent on how selector displaying. the second example @ radio button , see whether present in "on" state or not. this first 1 uses jquery addon <tr> <td>storeeval</td> <td>jquery('div.search-date-container div.modal').css('display')</td> <td>isselected</td> </tr> <tr> <td>gotoif</td> <td>storedvars['isselected']=='block'</td> <td>skiptodatepicker</td> </tr> this second 1 doesn't

How to use ConvertToWritableTypes in scala spark? -

i looking @ basicsavesequencefile , tried follow in scala so had: val input = seq(("coffee", 1), ("coffee", 2), ("pandas", 3)) val inputrdd = sc.parallelize(input) // no parallelizepairs but when try: val outputrdd = inputrdd.map(new converttowritabletypes()) // have no maptopair how write instead? how use converttowritabletypes in scala spark? right get: error:(29, 38) type mismatch; found : sparkexamplewriteseqlzo.converttowritabletypes required: ((string, int)) => ? val outputrdd = inputrdd.map(new converttowritabletypes()) ^ so you're looking @ java version, should looking @ scala version api's different. example give, don't need maptopair , can use normal map without static class: import org.apache.hadoop.io.intwritable import org.apache.hadoop.io.text val input = seq(("coffee", 1), ("coffee", 2), ("pandas", 3)) val in

google play services - Android manifest @integer/google_play_services_version not found -

hi using eclipse ide while compiling project got error message in android manifest.xml file. no resource found matches given name (at 'value' value '@integer/google_play_services_version'). how can solve it? to make google play services apis available app eclipse: copy library project @ /extras/google/google_play_services/libproject/google-play-services_lib/ location maintain android app projects. import library project eclipse workspace. click file > import, select android > existing android code workspace , , browse copy of library project import it. in app project, reference google play services library project. see referencing library project eclipse more information on how this. refer here more information on setting play services in app. https://developers.google.com/android/guides/setup

masm - Checking if two strings are equal in assembly -

the program check if user entered password matches 1 specified directly in program. not able understand why happen 'password incorrect' when try input directly keyboard. when specifying 'src' directly in program output seems perfect though. .model small .stack 1000h disp macro msg ;macro display string of characters lea dx,msg mov ah,09h int 21h endm input macro ;macro input character character mov ah,01h int 21h endm data segment cr equ 0dh lf equ 0ah msg db 'enter password please : ',cr,lf,'$' tru db 'password correct$' fal db 'password incorrect$' src db 10 dup('$') dest db 'yo$' len equ ($-dest) data ends code segment assume cs:code,ds:data,es:data start: mov ax,data mov ds,ax mov es,ax mov si,offset src mov di,offset dest cld mov cx,len xor bx,bx disp msg re: input mov [si],al inc si inc bx cmp al,cr jne re cmp bx,cx ;if string lengths dont matc

python - Stanford Parser and NLTK -

is possible use stanford parser in nltk? (i not talking stanford pos.) edited as of nltk version 3.1 instructions of answer no longer work. please follow instructions on https://github.com/nltk/nltk/wiki/installing-third-party-software this answer kept legacy purposes on stackoverflow. answer work nltk v3.0 though. original answer sure, try following in python: import os nltk.parse import stanford os.environ['stanford_parser'] = '/path/to/standford/jars' os.environ['stanford_models'] = '/path/to/standford/jars' parser = stanford.stanfordparser(model_path="/location/of/the/englishpcfg.ser.gz") sentences = parser.raw_parse_sents(("hello, name melroy.", "what name?")) print sentences # gui line in sentences: sentence in line: sentence.draw() output: [tree('root', [tree('s', [tree('intj', [tree('uh', ['hello'])]), tree(',', [',&#

erlang - What is the best way to assert the contents of a zip archive in Elixir? -

currently doing: testing function letting zip file/directory. assert exists. using :zip.t , :zip.tt let list down contents of zip folder see if it's expecting. somehow think missing something. better test :zip.table ? function looks confusing. can provide example of how use ? below example of output got to, can't figure out how make test ? md5sum better test zip archives ? iex(4)> :zip.table('testing.zip') {:ok, [{:zip_comment, []}, {:zip_file, 'mix.exs', {:file_info, 930, :regular, :read_write, {{2015, 7, 15}, {2, 11, 9}}, {{2015, 7, 15}, {2, 11, 9}}, {{2015, 7, 15}, {2, 11, 9}}, 54, 1, 0, 0, 0, 0, 0}, [], 0, 444}, {:zip_file, 'mix.lock', {:file_info, 332, :regular, :read_write, {{2015, 7, 15}, {2, 9, 6}}, {{2015, 7, 15}, {2, 9, 6}}, {{2015, 7, 15}, {2, 9, 6}}, 54, 1, 0, 0, 0, 0, 0}, [], 481, 152}]} the :zip module erlang not easy work with, i'll try break down you. first, need appropriate re