Posts

Showing posts from May, 2014

android - ImageView overlaps with TextView in ConstraintLayout -

i using recyclerview , code activity_main: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.romin.apodbrowser.mainactivity"> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginbottom="8dp" android:layout_marginleft="8dp" android:layout_marginright="8dp" android:layout_margintop="8dp" android:scrollbars="vertical" app:layout_constraintbottom_tobottomof="parent" app:la

performance - MySQL updates getting very slow towards end of the table -

i have table "data" holds around 100,000,000 records. have added new column "batch_id" (integer). on application layer, i'm updating batch_id in batches of 10,000 records each of 100,000,000 records (the batch_id same 10k). i'm doing (application layer pseudo code): loop { $batch_id = $batch_id + 1; mysql.query("update data set batch_id='$batch_id' batch_id null limit 10000"); } i have index on batch_id column. in beginning, update statement took ~30 seconds. i'm halfway through table , it's getting slower , slower. @ moment same statement takes around 10 minutes(!). reached point no longer feasible take on month update whole table @ current speed. what speed up, , why mysql getting slower towards end of table? index on primary key help? is primary key automatically indexed in mysql? answer yes so instead 1 index batch_id help. the problem without index engine full table scan. @ first easy find 10

ios - What happen to http request when applicationWillResignActive or applicationDidEnterBackground -

when app doing http request , user receive phone call , put app in background (so event applicationwillresignactive , applicationdidenterbackground fired), what's happen current active http request ? need worry (calling example beginbackgroundtaskwithexpirationhandler ) or system @ least let current http request finish ? assuming didn't opt-in multitasking, http call continue a while : according docs on applicationdidenterbackground , have 5 seconds complete ongoing tasks, hence unfinished http calls halt when actual suspension occurs. respective sockets timeout. if need more time, use background downloads or begin background task .

vert.x - Vertx merge contents of multiple files in single file -

what best way append contents of multiple files single file in vertx? have tried vertx filesystem , asyncfile both not have option append file or did not know of any. there alternative approach merge or append files in vertx asynchronously. the solution find make buffer list , write content on end of each previous buffer length using loop. indeed, of vert.x 3.4, there no helper method on filesystem append file file. you asyncfile , pump follows. first create utility method open files: future<asyncfile> openfile(filesystem filesystem, string path, openoptions openoptions) { future<asyncfile> future = future.future(); filesystem.open(path, openoptions, future); return future; } then 1 append file file pump : future<asyncfile> append(asyncfile source, asyncfile destination) { future<asyncfile> future = future.future(); pump pump = pump.pump(source, destination); source.exceptionhandler(future::fail); destination.exception

python - Email verification and password reset - django rest framework and angularjs -

how implement built in views password-reset in django.rest.auth , how create email verification system registration using django rest framework , angularjs? i have been searching tutorial or documentation on how implement django's send_email function in website using django rest framework , angular js haven't been able find any. what need... when new user registers url must generated them confirm email address this url must automatically sent user's given email after user sent link , confirms email address status must changed new_user.is_active = false new_user.is_active = true what have... registration form sends post request register endpoint the new user data unpacked, validated, , saved in register view in settings.py have added this... email_use_tls = true email_host = 'smtp.gmail.com' email_host_user = 'myemail@gmail.com' email_host_password = 'mypassword' email_port = 587 in urls.py have added this... from djang

Kill chromedriver process in Selenium / Java -

i running multiple java programs through jenkins using "build periodically" option , uses h 06 * * 1-5 (run every day between 6 , 7 monday friday). there programs in click on links opens new window. hence, use below code driver.findelement(by.xpath(".//*[@id='terms']/li[1]/a")).click(); system.out.println("home page loaded , terms of use link clicked"); arraylist<string> window1 = new arraylist<string>(driver.getwindowhandles()); driver.switchto().window(window1.get(1)); thread.sleep(3000); driver.close(); thread.sleep(3000); driver.switchto().window(window1.get(0)); now after program runs, other program following fails because of chromedriver.exe process running. i tried using driver.quit() instead of driver.close() in code above, close entire browser. note: have used driver.quit() @ end of program doesn't me getting rid of running chromedriver.exe instance opened when switched window. please suggest me a way ha

Spark DataFrame Filter using Binary (Array[Bytes]) data -

i have dataframe jdbc table hitting mysql , need filter using uuid. data stored in mysql using binary(16) , when querying out in spark converted array[byte] expected. i'm new spark , have been trying various ways pass variable of type uuid dataframe's filter method. ive tried statements val id: uuid = // other logic looks df.filter(s"id = $id") df.filter("id = " converttobytearray(id)) df.filter("id = " converttohexstring(id)) all of these error different messages. need somehow pass in binary types can't seem put finger on how properly. any appreciated. after reviewing more sources online, found way accomplish without using filter method. when i'm reading sparksession, use adhoc table instead of table name, follows: sparksession.read.jdbc(connectionstring, s"(select id, {other col omitted) mytable id = 0x$id) mytable", props) this pre-filters results me , work data frame need. if knows of solution us

vba - Need to click on Navigation bar to logout the session -

need click on navigation bar logout session. please see html tag: <nav class="account"> <h3 tabindex="0"><span>account options</span></h3> <ul> <li><a href="account/details">account details</a></li> <li><a href="changepassword">change password</a></li> <li> <a href="logout">logout</a></li> </ul> </nav> following code , not clicking navigation bar: dim objie internetexplorermedium set objie = new internetexplorermedium objie.visible = true objie.navigate "https://staging-site.com/" while objie.busy or objie.readystate <> readystate_complete: doevents: wend objie.document.getelementsbyclassname("account").click = 0 while < accountoptions.length if accountoptions(i).class = "account"

django how to model this table correctly? -

following suggestions last post got far: post model: class post(models.model): title = models.charfield(max_length=120) content = models.textfield() group model: class group(models.model): title = models.charfield(max_length=200) url = models.urlfield(unique=true) contact_updated = models.datefield(auto_now=false, auto_now_add=true) group_status = models.charfield(max_length=20) admin = models.charfield(max_length=20) admin_status = models.charfield(max_length=20) frequency = models.integerfield() # allowed post frequency frq_scale = models.charfield(max_length=20, blank=true) obs = models.textfield(blank=true) posts = models.manytomanyfield(post, through='control.control') control model: class control(models.model): published = models.datefield(auto_now=false, auto_now_add=false) post = models.foreignkey('posts.post', on_delete=models.cascade) group = models.foreignkey('groups.group'

python - How to rollback create table with sqlalchemy transaction? (sqlite) -

#!/usr/bin/env python3 import logging import sqlalchemy logging.basicconfig() logging.getlogger('sqlalchemy').setlevel(logging.debug) engine = sqlalchemy.create_engine("sqlite:///test.db") connection = engine.connect() transaction = connection.begin() try: connection.execution_options(autocommit=false).execute("create table test (`id` int not null);") connection.execution_options(autocommit=false).execute("create table test (`id` int not null);") transaction.commit() except: transaction.rollback() raise i have python script. expectation be, database doesn't have table test afterwards, does. doing wrong/how can rollback create table ? $ python3 --version python 3.5.3

xml - XSLT newline not working in MS Build task -

i'm trying transform xml file textfile ms build xsltransformationtask (https://msdn.microsoft.com/en-us//library/ff598688.aspx) . my problem can print new lines if combine them other (non-space) text. example <xsl:text>&#10;</xsl:text> not produce newline, <xsl:text>&#10;sampletext</xsl:text> does. tried other variants <xsl:text>&#xd;</xsl:text> , <xsl:text>&#xa;</xsl:text> same result. ms build task: <target aftertargets="build" name="test"> <xsltransformation xslinputpath="config.xslt" xmlinputpaths="config.schema.xml" outputpaths="out.txt" /> </target> xslt doc: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method='text' /> <xsl:template match="/root/properties"> <xsl:for-each select="./*"> <!--working new

pymongo - How would I sum the number of upvotes by specific field in mongodb -

i sum number of upvotes specific field in mongodb. example returning sum of number of upvotes author john has gotten. { "_id": "fc0996a9726e4bf08c3d614afe05c7a8", "blog_id": "f8da5ae532aa44f6a54d86fd822f7d52", "author": "john", "content": "hello", "upvotes": 3, } { "_id": "dea0a9713a734717920b652eed268b99", "blog_id": "f8da5ae532aa44f6a54d86fd822f7d52", "author": "john", "content": "hello", "upvotes": 2, } { "_id": "3d286c4ce54046f4aac9ea627a48f04e", "blog_id": "f8da5ae532aa44f6a54d86fd822f7d52", "author": "john", "content": "hello", "upvotes": 1, } { "_id": "6782b555dd8c47f58dba28e60fda4a5f", "blog_id": "f8da5ae532aa44f6a54d86fd822f7d52", "author": "123",

asp.net - WebBrowser control in web server not returning Cookie from Website -

i attempting go https site webbrowser control in web application, basic information site (the site not have web service or other api @ point) when iis express able connect login , navigate other pages when directly connecting web browser on system works fine. from development systems i.e. windows 10 or windows server 2016 can publish web application, connect web application , through web application connect site, login , load other pages works fine. but…. when deploy godaddy , connect site through application able log in when navigate page redirected login page. i have noticed not jsession cookies when going through application on godaddy them in of other successful cases. receive jsesson cookies before log in @ target site: http://www.altavista.com/ website returns cookies on connect should suffice. have changed user agent same agent have on desktop , connected , still same results on godaddy. i have tried on godaddy sites ssl protected (https) , not (http). has run type o

openssl - Running Newer Ruby Version Next to Existing Ruby Version -

disclosure: know little ruby beyond basic code syntax. bear idiocy. ruby 1.8's openssl library doesn't seem support tls 1.2. however, there apps running dependent on 1.8, want see if can run newer version of ruby concurrently on same system , set newer versions of same gems. currently version 1.8 @ /usr/lib/ruby/1.8. ideally, i'd keep same structure , install newer version (not sure recent, stable version - whether it's 2.3.x or 2.4.x). that said, not ruby admin. inherited server else decided ruby best way things, despite there being no other ruby experience within company, , left. know system admin stuff, don't know: how backwards-compatible ruby versions (e.g. app built against 1.8 run without major modifications on 2.4.1). how gems work / updated. can 2.4.1 use gems 1.8, or gems tied specific ruby versions? can there mix-and-match? there migration path of kind? how manage 2 different concurrent versions (how tell app use 1 version on other, or prev

bash - Unix - Delete a portion which matches a regex -

i have log file , trying tidy use data inside. want use sed 's/foo//g' except instead of matching word foo want delete foo until next space. i tried (without success): sed -e -- 's/(?<=foo)(.*)(?= )//g' any ideas? i want delete foo until next space. you can use: sed 's/foo[^[:blank:]]*//g' file [^[:blank:]] match character not space , not tab.

How to check state Changing of Radio Button android? -

i want check if radiobutton clicked change value here's code : new dynamicviews().makeradiobutton(getapplicationcontext(),radiogroup,"ok"); new dynamicviews().makeradiobutton(getapplicationcontext(),radiogroup,"ok"); radiobutton radiobutton = new dynamicviews().makeradiobuttonforanswer(getapplicationcontext(),radiogroup,"this answer"); the first 2 radios created without referencing last 1 answer got reference check if checked. here question : how can check if radiobutton ticked? radiobutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { gotonextlevel = true; } }); this approach far not work because when users select radiobutton , after change choice value of gotonextlevel not change , set true in wrong way. how find out long radiobutton checked set gotonextlevel true ,

memory management - How do I create an array or list of externally managed objects in modern c++? -

i building add-in program. add-in manipulates ptr objects passed me host application. create vector of externally created , managed objects host. unfortunately, documentation doesn't have clear examples of how this. class players { vector<ptr<player>> vectorofgamers; // deletes , when this? public void createplayers () { // call static application create 3 players ( int = 0; < 3; i++ ) vectorofgamers.push_back(application.getnextplayer()); } } confused how build class , prevent memory leaks , causing null exception if items deleted prematurely. also, how use modern c++ facilities achieve yet gain of benefits of new memory management make_shared, make_unique, nullptr, etc? for information, below snapshot of ptr.i confused ptr appears superfluous given modern c++'s new memory management facilities. class incompletetype { public: template<typename t> static void addref(void* ptr) { reinterpret_cast<adsk::cor

javascript - Angular material input number change format -

in angular-material app have field validation: <input type="number" ng-model="myvalue" name="myvalue" min="0" max="100" ng-pattern="/^[0-9]\d*(\.\d+)?$/" required> it works fine. need make allow user type .75 , instead of 0.75 so question how apply filter: if( myvalue.substring(0,1) == "." ){ myvalue = "0" + myvalue; } before angular material ng-pattern , type="number" validation you can write directive $filter , $formatters , $parsers : app.directive('parser', ['$filter', function($filter) { return { restrict:'a', require: 'ngmodel', link: function(scope, element, attrs, ctrl) { ctrl.$formatters.unshift(function (a) { return $filter('myfilter')(ctrl.$modelvalue) }); ctrl.$parsers.unshift(func

.htaccess - Multiple url redirection in apache :mod_rewrite -

i new apache , wish redirect existing url (1) new url(2) , final url(3). redirection url (1) url(2) existing redirect rule defined , cannot pass it. due cannot jump form jump directly url (1) url(3). below exsitng code: for eg: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^/portal-web-payment/(.*)$ /portal-web/$1 [r] rewriterule ^/portal-web/abc/portal/payment/web/mbbquickrecharge/(.*)$ - [l] </ifmodule> i wish insert below rule existing one, not working. rewriterule ^/(.*)(portal-web/abc/portal/payment/web/mbbquickrecharge/prepaidquickrechargecontroller.jpf)(.*)$ http://yahoo.com/servlet/du/en/mobilebroadbandrecharge.html [l,r=302] below final redirect url wrote, not working. <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^/portal-web-payment/(.*)$ /portal-web/$1 [r] rewriterule ^/portal-web/abc/portal/payment/web/mbbquickrecharge/(.*)$ - [l] rewriterule ^/(.*)(portal-web/abc/portal/payme

sql server - File table with clustered index -

i have read through available documentations file table on sql server. 1 thing has not mentioned creating additional indexes (non-unique clustered index in case) on file table fixed schema. am right fine , wouldn't cause issues? if issue best approach? according create, alter, , drop filetables topic in sql server documentation (emphasis mine): since filetable has pre-defined , fixed schema, cannot add or change columns. however, you can add custom indexes, triggers, constraints, , other options filetable . so should fine adding custom indexes.

function for converting DMS format to Decimal in Microsoft Excel Visual Basic -

Image
i have problems using visual basic in ms. excel. have sort of coordinates data in dms format (longitude , latitude) it's not in usual format. data seems this: e 103 29 12.4562 w 3 9 1.4562 n 16 5 32.4333 s 16 5 2.4333 i want convert standard decimal format. however, i've never used visual basic before. convention e, n , w, s 1 , -1, respectively. expecting output data list 103.4867934 -3.1504045 16.09234258 -16.08400925 i hope can make visual basic code convert data because have lots of data , can't convert manually. thanks. instead of vba can use formula: =--(index({"+","+","-","-"},match(left(a1,1),{"e","n","w","s"},0))&mid(a1,3,find(" ",mid(a1,3,len(a1))))+mid(a1,find("}}}",substitute(a1," ","}}}",2))+1,2)/60+mid(a1,find("}}}",substitute(a1," ","}}}",3))+1,99)/3600)

How to query Facebook and google graph APIs after logging in with FirebaseAuth-UI for iOS with permissions approved -

i working on login flow firebaseui ios. facebook provider invoked scope(permission) user_friends. after user approves app , permissions, login successful. however, wondering how retrieve user_friends via graph api call facebook directly. essentially, retrieve required parameters successful firebase auth make successful graph api retrieving user_friends list.

python 2.7 - defining __call__ on a class as the constructor -

i'm trying use __call__ in way i'm not sure impacts. i working base code data uses import return arbitrary item module this: try: mod = __import__(mod_name, globals(), locals(), [object_name]) finally: sys.path.remove(search_folder) # object_name global variable in module return getattr(mod, object_name) currently, each module define class , function. function in question create new instance of same class defined in module, passing given parameters class constructor. to attempt avoid copy/paste function, changing call class, defined superclass call method, , inside method call same class constructor, this: class foobar(object): def __init__(self, one, two): self.one = 1 self.two = 2 def __call__(cls, one, two): return cls(one, two) it seems working on tests cases, i'm not sure impacts of using such design. should add have restriction of not changing current base code (i tried first @staticmethod didn't work).

Android, Gradle, Realm, Kotlin: Error:error: Could not find the AndroidManifest.xml file -

android studio 2.3.3, java 8, kotlin 1.1.3-2 project's build.gradle: // top-level build file can add configuration options common sub-projects/modules. buildscript { ext.kotlin_version = '1.1.3-2' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:2.0.0-alpha6' classpath "io.realm:realm-gradle-plugin:3.5.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() maven { url 'https://dl.bintray.com/jetbrains/anko' } } } task clean(type: delete) { delete rootproject.builddir } repositories { mavencentral() } app's build.gradle: buildscript { repositories { maven

python - Can't install numpy-mkl -

this question has answer here: installing scipy pip 14 answers can't install scipy through pip 17 answers the command: pip install numpy-mkl gives me error: could not find version satisfies requirement numpy-mkl (from versions: ) no matching distribution found numpy-mkl i tried existing solutions nothing seems working. also, can tell wheel version manual installation python 3.6.2 running on windows 8 (x64)? numpy-mkl seems requirement install scipy . getting error while installing it. edit: i tried listed on page redirected making duplicate. still cannot install numpy-mkl . please help.

smartsheet api - How can I rename image attachments with the row number using python through the API? -

i started learning python address issue(only having html experience previously). backup our sheets sharepoint. problem came across backing smartsheet drops images single zip file , there isn't way know row went to. therefore programming thing download separately row names or modify images in place , adding row name. i've managed access api , download images but, can't row numbers on image files. modifying attachment inside smartsheet make backups easier isn't best solution. rows can moved around, or multitude of other things can occur make relying on filename provide row number problematic. when you're getting attachment information, there parameter in data called parentid unique id row. should use row id, rather row number. then, when download attachment, can set local file name include row id information.

python 3.x - Pandas DataFrames- value counts from many columns and survey multiple answers -

i'm struggling 2 issues: i have exemplary dataset cars. 20 respondents asked favorite cars. enumerate maximally 5 cars (columns "answer 1"- "answer 5". how can number of mentions of each car? for cars mentioned in columns answer 1 - answer 2 each respondent noted 3 advantages of each car (for example columns adv car 1_1 , adv car 1_2 , adv car 1_3 related first mentioned car, adv car 2_1 , adv car 2_2 , adv car 2_3 related second car etc.). how can show how many particular advantages related each car mentioned? need informations this: ferrari - engine 3 times, color - 5 times, price - 3 times etc, audi - engine - 4 times, color - 3 times, price - 2 times etc. the second issue related spss , r variables cases, can't translate python. in case related melting dataframes, attempts weren't effective. i'll thankful help. csv file available download or below: no;answer 1;answer 2;answer 3;answer 4;answer 5;adv car 1_

php - Doxygen: @var using namespaces -

i'm starting use doxygen document php code. see following example: namespace \myclasses; class order { /** * description * * @var \myclasses\customer $customer */ protected $customer; } the @var command renders myclasses customer myclasses\order::$customer type instead of \myclasses\customer myclasses\order::$customer correct, leaving namespace intact. there way achieve this? putting 2 backslashes \\myclasses\\customer doesn't work either. @param on other hand seems work namespaces. i'm using latest version 1.8.13. config default.

browser - How to get simple Webpack bundle up and running using webpack-dev-server -

i scratching surface of building development environment webpack, webpack-dev-server, , hot module reloading. want able add react components static site (so seo benefit of having crawlable html. i've decided not use gulp or grunt, instead i'll solely use npm scripts run shell commands development, testing, building, , publishing. returning title/topic of question. have not been able browsers read bundle.js file generated webpack. i've boiled library down simplest index.html , index.js can see below. the error output console is: uncaught referenceerror: handleclick not defined @ htmlbuttonelement.onclick ((index):7) the emitted bundle.js file must error is: /******/ (function(modules) { // webpackbootstrap /******/ // module cache /******/ var installedmodules = {}; /******/ /******/ // require function /******/ function __webpack_require__(moduleid) { /******/ /******/ // check if module in cache /******/ if(installedmodules[moduleid]

python - Requests POST data not being appended to url -

i trying send simple post request server using requests. doing (i think @ least) quickstart ( http://docs.python-requests.org/en/master/user/quickstart/ ) saying do. post request seems ignoring data= tag , not appending data end of url. have: import requests, json url = 'http://localhost:5000/todo/api/v1.0/tasks' payload = (('key1', 'value1'), ('key1', 'value2')) r=requests.post(url, data=payload) print 'url is: ', r.url and output is: url is: http://localhost:5000/todo/api/v1.0/tasks i don't know if relevant or not, if use tag params=, url assembled expect: r=requests.post(url, params=payload) url is: http://localhost:5000/todo/api/v1.0/tasks/?key1=value&key1=value2 anyone see wrong? in advance try dump payload json , use dict payload = {} payload[key1] = value1 payload[key2] = value2 payload_data = json.dumps(payload) r=requests.post(url, data=payload_data)

How to create namespace in Aerospike DB from php client -

how can 1 declare namespace in aerospike db default php client? have gone through documentation @ http://www.aerospike.com/docs/client/php cannot find useful. although can find following code @ http://www.aerospike.com/docs/operations/configure/namespace namespace <namespace-name> { # memory-size 4g # 4gb of memory used index , data # replication-factor 2 # multiple nodes, keep 2 copies of data # high-water-memory-pct 60 # evict non-zero ttl data if capacity exceeds # 60% of 4gb # stop-writes-pct 90 # stop writes if capacity exceeds 90% of 4gb # default-ttl 0 # writes client not provide ttl # default 0 or never expire # storage-engine memory # store data in memory } but how do php ? what quote above configuration file syntax , namespace stanza (entry) in configuration file. ( /etc/aerospike/aerospike.conf default. ) the way create namespac

c++ - Simple code of array gives me a Runtime error -

Image
i can not understand why code broke when try run it. use gcc compiler #include <iostream> using namespace std; int main() { int arr[] = {0}; for(int x=0; x<6; x++) arr[x] = x; for(int y=0; y<6; ++y) cout<< "arr[" << y <<"] = " << arr[y] << endl; return 0; } output: int arr[] = {0}; declares array 1 element in it. therefore, valid index array arr[0] . trying index non-zero integer result in undefined behavior.

javascript - node.js search and replace an exact string in json output using variables -

i have found lot of posts show how search , replace exact string between quotes when using wild card or direct search string. when using variables in for loop having trouble getting correct syntax. i have number of keys in json output db, myjson = json.stringify(rowsmap); gives { "mystuff": [ { "abc": "val_de_1", "abcxz": "val_xc_1", "mnabc": "val_abc_1" }, { "abc": "val_de_2", "abcxz": "val_xc_2", "mnabc": "val_abc_2" }, { "abc": "val_de_3", "abcxz": "val_xc_3", "mnabc": "val_abc_3" } } now loop on json , replace of key strings using 2nd k:v pair (var myval in mypairs) { myjson = myjson.replace(regexp(myval, "g"), mypairs[myval]); .... } now if values abc 777 follo

c# - Use Memoized Method for Recursive Function -

i have memoizer function so: static func<a, r> memoize<a, r>(this func<a, r> f) { var cache = new concurrentdictionary<a, r>(); return argument => cache.getoradd(argument, f); } and have recursive method long therecursivemeth (string instring) { // recursive function calls } now, in main function, try: therecursivemeth = therecursivemeth.memoize(); but compiler complains the '.' operator cannot applied operand of type `method group' and the left-hand side of assignment must variable, property or indexer how make calls therecursivemeth call therecursivemeth.memoize() , including recursive calls? edit: i'm trying avoid editing definition of therecursivemeth . have check dictionary. edit 2: since you're interested, have function counts number of palindromes of given string. it's little complicated explain here, like: long palcount(string instring) { if (instring.length==1) retu

r - Proportion Table by Group by Year (data table) of Unique Observations -

i have table unique {id, product type}, , runs year: id product_type sex year 1 f 2000 1 b f 2000 1 b f 2001 1 m 2000 1 b m 2000 1 b m 2001 etc. i proportion table of sex year (% of male , female customers year). this tried, library(data.table) dt <- data.table(salesdata) dt[, .(distincts = length(unique(id))), by=list(year,sex)] and gives me count of gender year. how can percentages or proportions of males , females year? try this: gmodels::crosstable(dt$sex, dt$year, prop.t = f, prop.chisq = f) cell contents |-------------------------| | n | | n / row total | | n / col total | |-------------------------| total observations in table: 6 | dt$year dt$sex | 2000 | 2001 | row total | -------------|-----------|-----------

java - Undo, Redo in Sudoku game Android -

i'm trying implement undo , redo button in android sudoku game, it's complicated cause user can draft(put in numbers think potentially answer cell), insert value think is, remove specific number draft or value , delete draft values. thinking of using stack holds sort of object saves state of object , pop revert back, can't seem find that. momento object seems closest, think saves 1 state , returns state. suggestions? cell{ isnoteditable draftvalue value x y } sudokustep{ arraylist<cell> } you can keep cells each step, , keep steps in arraylist move between steps. ofc have modify steps wheter user didn't redo , moved etc

javascript - unwanted horizontal margin between divs -

this question has answer here: how remove space between inline-block elements? 31 answers i working on tic tac toe game , reason divs seem have margin left or right. anyway there's horizontal margin between divs. need squares close each other. how can achieve that? here's pen if interested in seen how looks: https://codepen.io/zentech/pen/xlrzgr body { background-color: #174c6d; font-family: verdana, sans-serif; color: white; } h1 { font-size: 50px; } h2 { margin-bottom: 30px; } .container { margin: 0 auto; text-align: center; } .row>div { margin: 0px; display: inline-block; font-size: 40px; width: 70px; height: 70px; text-align: center; padding: 0px; vertical-align: top; line-height: 70px; } .right { border-right: solid 5px white; } .bottom { border-bottom: solid 5px whi

android - RecyclerView with multiple onclick events on textviews -

i want build recyclerview few columns within each row should clickable different events. unfortunately, haven't been able determine onclick being clicked within row, call same method. what's best way handle this? should declare multiple views within row , assign onclick each view? here recyclerview.xml file: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content"> <relativelayout android:id="@+id/layout" android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:text="description" android:id="@+id/description_textview" android:layout_width="180dp" android:layout_height="wrap_content&