I'm getting this error: Cannot concatenate the table variable 'epoch' because it is a cell in one table and a non-cell in another. To reproduce the error: A.epoch = [1,2,3]'; A.value = [10,20,30]'; Initialized empty table with headers: Aclean = cell2table(cell(1,2), 'VariableNames', {'epoch', 'value'}); Vertically concatenate the 2 tables: Aclean = vertcat(Aclean, struct2table(A)); What is the best way of concatenating tables with a for loop in Matlab? 1 AnswersAnswers 1 If I understand right, you...
Sunday, September 30, 2018
Drag and drop issue in Chrome related to Windows scale (125%)
I have an issue with drag and drop on Chrome (v69.0.3497.100). Specifically, some of the drag and drop events are getting fired when Windows scaling is other than 100% even though they shouldn't be firing. Check out stackblitz example, and try to drag "blue" rectangle over itself (just drag, move a little bit downwards and drop). If Windows scaling is set to 100% (browser zoom is 100% as well) then one event is fired (dragEnter) as expected (check the console). But, if Windows scaling is set to 125% (but browser zoom is...
Register a package for the class generated from the proto file in the gradle by default , not in proto file
In my android app I use proto files. For example, I have proto file Stats.proto syntax = "proto3"; package com.me.test; message Stat { string a = 1; string b = 2; string c = 3; string d = 4; } I need to register package in the each proto file itself, and this is uncomfortable, because I have a lot of files. I want to register default package in gradle, for example, 'package com.me.test', which uses each file that I create. I found solution in javanano nano { proto { // Selects between --java_out...
get position of the text inside a TextView

suppose i have the following text 'ADD TEST' inside TextView as shown below as you can see the text inside the textView does not have the same width and height as textView . what i want is to get the x,y position of text inside the textView 2 AnswersAnswers 1 Y value You can use textView.getTextSize() or textView.getPaint().getTextSize() to get the actual used text size in pixels (as Float). Next, we need the total height...
gradle: disable creation of the build folder at root in multi-projects application
My gradle project is a multi-project structure. It consists of two subprojects. My build.gradle in root project as following: allprojects { apply plugin: 'eclipse' } subprojects { apply plugin: 'java' apply plugin: 'maven-publish' publishing { repositories { maven { name 'myMaven' def suffix = project.version.endsWith("SNAPSHOT") ? "snapshots" : "releases" url baseUrl + suffix } } publications { core(MavenPublication) { artifactId project.name ...
Python lagged series to Pyspark
I am trying to do adapt this Python code in pyspark: from statsmodels.tsa.tsatools import lagmat def lag_func(data,lag): lag = lag X = lagmat(data["diff"], lag) lagged = data.copy() for c in range(1,lag+1): lagged["lag%d" % c] = X[:, c-1] return lagged def diff_creation(data): data["diff"] = np.nan data.ix[1:, "diff"] = (data.iloc[1:, 1].as_matrix() - data.iloc[:len(data)-1, 1].as_matrix()) return data The result is a dataframe with lagged columns. I tried something like that:...
How to fix or work around apparent bug in plotly's event_data(“plotly_hover”) when interrogating 3d surface plots

I've produced an app where the aim is to combine four surfaces of values on a common 3D plane, with corresponding subplots that show cross-sections of z ~ y and z ~ x. To do this I'm trying to use event_data("plotly_hover") to extract the x and y values of the surface. However, the maximum x value recorded by event_data("plotly_hover") is truncated at around 38, whereas the maximum x value is 80. The tooltips for the surface itself,...
How to show HTML text in Android while detecting clicks on specific phrases and scrolling position?
I'm getting a wall of plain HTML text from the server and need to render it in my application, but that's not all. I also need to detect clicks on specific phrases within the text. The phrases are defined by two numbers: word count where the phrase starts and word count where it ends (e.g. from word 10 to word 15). My intuition says that I could probably instrument the HTML with links or some JavaScript according to phrases spec and then listen for clicks on these links. However, I'm not sure how to achieve this kind...
Share Database between React Native Apps

I am building two react native apps where i need to keep few things in common like username(login) and few other information.I tried to store using AsyncStorage (React Native Storage) and everything was working but now i need to use one common data base for both the apps as the user login success in first app then the other app should also be logged in.As Asyncstorage cannot be used in this case any other option in react native. ...
Saturday, September 29, 2018
Hierarchical queries with Mongo using $graphLookup
I have an employee collection with half a million records. Each record will have the following details. The mongo document is as follows. { "_id": "234463456453643563456", "name": "Mike", "empId": "10", "managerId": "8", "projects" : [ "123", "456", "789"] } When i give any empId, it should return the complete hierarchies from that manager to the bottom level along with the following filter. a. filter on location b. filter on projects The result should be like, 10 ->>> Manager...
Why will changing this CSS effect using JS only work smoothly for certain values?
I am trying to move an image slowly relative to the viewport when the user scrolls the page. Similar to the effects found here https://ihatetomatoes.net/demos/parallax-scroll-effect-part-2/ If the image is moved by a small value then it moves smoothly. If it is moved by a larger amount then it becomes very janky. var imageOffset = lastScrollY * 0.9; $image.css({top: `${imageOffset}px`}); //Runs badly var imageOffset = lastScrollY * 0.3; $image.css({top: `${imageOffset}px`}); //Runs well Why does the value...
Exclude the overlay app icon from a screenshot
Im just brainstorming an idea and Im checking its possibility before starting the code. Lets say I have an app that takes a screenshot whenever I tap on its overlayed icon on screen,is there a way to exclude my app's icon from the resulting image? 2 AnswersAnswers 1 The media projection APIs simply capture what is on the screen. There is no means to say "ignore this window", other than by making the window not be there (or be transparent) at the time of the screen capture. Answers 2 very simple hide the icon...
Friday, September 28, 2018
If I have two content types with a relationship between them in Drupal 8, why would I want to put a reference field in both content types?
If I have two content types with a relationship between them in Drupal 8, in order to represent the relationship, I can put a reference field to the other content type in one of these two content types. But in this video tutorial, it shows an example where both content types contains a reference field to each other. In what situations would I want to put a reference field in both content types? 1 AnswersAnswers 1 If you are user of the example website in the video, I can think of these two use cases: I am viewing...
Long running script from flask endpoint
I've been pulling my hair out trying to figure this one out, hoping someone else has already encountered this and knows how to solve it :) I'm trying to build a very simple Flask endpoint that just needs to call a long running, blocking php script (think while true {...}). I've tried a few different methods to async launch the script, but the problem is my browser never actually receives the response back, even though the code for generating the response after running the script is executed. I've tried using both multiprocessing...
How does the YouTube android app select video codec?
I have enabled stats for nerds option in YouTube android app and played the same video in "Vivo V9" and "Nexus 5" device. Vivo V9 : It played the video in WebM format which is basically "VP8 or VP9" codec. Nexus 5 : It played the video in MP4 format which is basically "H264 or H265" codec. So, based on the device YouTube app selects video codec. Question : How does it do ? I know internally it uses ExoPlayer for playing video but ExoPlayer by default doesn't give functionality. 1 AnswersAnswers 1 Different codecs...
creating and appending to a list in SQLAlchemy database table
I am learning SQLAlchemy and I am stuck. I have a SQL table (table1) has two fields: 'name' and 'other_names' I have an excel file with two columns: first_name alias paul patrick john joe simon simone john joey john jo I want to read the excel file into my table1, so that it looks like this (i.e. all of the aliases for the same line are on one row): paul patrick john joe,joey,jo simon simone This is the idea that I was trying to do. The code (with comments) that I tried: for line in open('file.txt',...
Thursday, September 27, 2018
How to show uploaded php file as plain text instead of executing it in wordpress?

Edit a testme.php file in /tmp. <?php echo "test"; ?> Edit a new post titled test and upload file /tmp/testme.php ,pubish it with url http://home.local/wp/?p=4785. I want to see the content in testme,click it,pop up new window in wordpress. Go on to click it.test shown in webpage. My expect : 1.just click testme in test post for one time. 2.show the testme.php as plain text , <?php echo "test"; ?> instead...
rxjava + retrofit - How to wait and get the result of first observable in android?
I've recently started learning retrofit and rxjava. I'm looking for any ideas on how to wait ang get the result of first observable. Basically, I want to apply it on a simple login. The first api call is getting the server time. The second api call will wait the result of the first call (which is the server time) and utilize it. Retrofit retrofit = RetrofitClient.getRetrofitClient(); LocalServerInterface apiInterface = retrofit.create(LocalServerInterface .class); Observable<ServerTime>...
Unable to create a loop to compare the content of two sheets
I've written a script which is supposed to compare the content of column A between two sheets in a workbook to find out if there are partial matches. To be clearer: If any of the content of any cell in coulmn A in sheet 1 matches any of the content of any cell in coulmn A in sheet 2 then that will be a match and the script will print that in immediate window. This is my attempt so far: Sub GetPartialMatch() Dim paramlist As Range Set paramlist = Sheets(1).Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)...