dcc.Upload to create dcc.graph, but how is placeholder dcc.graph already in layout updated? - plotly-dash

I'm using dcc.Upload to read data from a spreadsheet. That data is manipulated, put into a pandas data frame, and then px.line is created. I wish to pass px.line to a dcc.Graph in my layout. The graph can be displayed with .show() but not in the dcc.Graph created in my layout.
Intuitively, I simply want to update dcc.Graph in my layout, but that doesn't seem possible without a callback. I can return px.line to the function associated with dcc.Upload, but I can't get it from there to the dcc.Graph I wish to update. Adding a second output to dcc.Upload to update dcc.Graph in my layout doesn't work.
Essentially, I'm trying to update a graph by pointing to a spreadsheet with dcc.Upload.
Any help greatly appreciated.
Thanks, little_old_man
As mentioned, I tried adding a second output to the dcc.Upload callback to update dcc.Graph in my layout, but that led to an error.
I've looked at dcc.Interval to poll for some signal to update the graph independent of any user input. Pointing to the spreadsheet in dcc.Upload is the user input.
I'm still stuck moving the data created from the input spreadsheet outside the scope of dcc.Upload to the dcc.Graph in my layout. Is dcc.Store needed?

Related

Scan an area of a web page's source code for changes while reporting it?

this is one heck of a confusing question to ask so here it goes. Firstly, I'm not asking you to write me any code I just need help going in the right direction for what I'm trying to achieve here. Basically the task is this, I want to scan a select area of a web page's source code for changes and if something does change, I want to report it somewhere (like a console or something). However, I do not want just a notification of change, I also want what the change is/was. I've been looking into things like jsoup but I am still struggling to even find out what this is called.
Any pointers would be insanely appreciated. Thanks, Optimistic.
Here are some steps assuming this is from a node.js project:
Get the URL for the specific script file you're looking for a change in.
Using the request() module, fetch that URL.
Break the data up into lines (probably using .split()).
Find the specific line you are looking for either by counting line numbers of by searching for some representative text in that line.
Using some sort of search in that line (perhaps a regex), find the current value of the exact item in that line you are looking for.
Save the current value.
Then, at some future time, repeat this whole process and compare what you find to the previous value.
If this is being done from a browser instead of node.js, then use an Ajax call to retrieve the file. If the file is on another domain from your web page and that domain does not permit cross-origin requests, then you cannot solve this problem in an automated fashion from a browser in your own web page.
Here is how I would do it with Jsoup:
Document doc = Jsoup.connect(url).get();
String scriptCssQuery = "script"; // Tune this CSS query to find THE script you need.
Element script = doc.select(scriptCssQuery).first();
if (script != null) {
String scriptLines = script.html();
// Store the changing line somewhere and compare it to its previous value...
}

Sequentialising Google Sheets Macro

I'm looking for a way to recursively generate links to next pages on a website with canonical structure. In essence, I'm trying to generate a link to each next page and then feed that result back in to the process to find the following page ad infinitum. However, I'm having problems automating this as the macro seems to be trying to generate the result for cells that are empty (i.e. the results for an earlier cell hasn't been created/copied yet).
So I'd like to sequentialise the macro to start from A20, generate the result for that cell, copy that result to A21, then begin the macro again for A21, et cetera, without requiring constant human input.
The Google spreadsheet with the error can be seen here in cell C27 and the macro itself can be seen here.
I realise this may be quite a roundabout way to perform this task and am open to any suggestions that may be easier, more intuitive, or faster.
So two suggestions: one is that with stuff that is a continuous scroll, its very easy to find the json of the source, and either grab all the data you want in one go, or by easily picking out the "next page" or pagination...
I personally use importdata() and importxml() more than any other functions, and when in google sheets I also use regexextract() and regexreplace() when needed.
for example the json your looking for is here: http://iconosquare.com/controller_nl.php?action=nlGetMethod&method=mediasTag&value=cricket&max_id=1145408330912313787
if you look at the top row, it tell you what the next min and max is so technically you could just extract that piece to generate your url.
Second option is to just build the query such that it autoincrements the urls. I can give you an example, but I would like to understand a little more about what you really want in the end result...
Are you just looking for the pagination urls, or are you wanting to extract the actual data from them?

Matlab gui for selecting a text file and the utilize it in further code

I have spent a long time studying about the gui. I have made the blank template containing all the buttons and input editable text box. but am facing problem with callback functions.
I have written a code which requires manually entering the text file containing data into the script file and then input a variable's value (in this case 'b') which is then utilized in the later part of the code. i wanted to make the program more user friendly so that one can select the text file from any directory by pushing a button and can change the value of b in a box provided. Also I have not included any functions in the main code...so its a basic data fitting code.
I tried studying about gui in matlab and other resources but am not able to understand it and use it. Therefore i cant put any of my work done uptill now. Please help me in solving the problem..
You may create a button in your GUI and include the following code in the associated callback function:
[aux_file,aux_path]=uigetfile();
if ~isempty('aux_file')
handles.data.file_name = fullfile(aux_path,aux_file);
handles.data.file_data = load(handles.data.file_name);
guidata(handles.figure_window, handles);
end
Now, you can use the data in other functions.

SSIS adding new columns to the Source

I am new to SSIS. I have a problem. i get data from two different data sources. I am able to merge them using Merge Component and feed the output to a Script component where i validate data and move it to the destination. Every thing is working fine. I want it to work when we add some extra columns in any sources.
The problem is when i add extra columns in source, i should add the input columns in the script component(check the ckeck boxes in Input Columns). Is there any way to do this?
Plz help
Try adding the new column to the source, open the package and then follow the flow through. You will have to go into subsequent controls including the merge control to refresh the data with this new field.
SSIS will prompt you with the exclamation mark at each stage where a refresh is mandatory(such as source control), although you will have to manually step through the flow components (such as merge) where a column output is optional.
For example, I added cost as a new column to the basic ole db source below
and after updating the source control, I have the opportunity to add it to the script component as you mention - but it is not mandatory for me to do so
the new field should be available in the sort component, even if its not used within the script control. You will however need to tick the field as a pass through on the sort control to get it into the merge component

Plone and Mysql Searching

I have Mysql and Zope talking to each other nicely.
I can insert values in, and even view one record from the databse and have it show up in the form fields(not that cool really).
I have just been following tutorials, but now I need to search the Database and display the results.
I have been fiddling with this for a while but I haven't gotten far.
I know that using a Zope Page template we can call the Zsql method and show the results with TAL, but I need to some how using a script and a redirect form the search form pass the search data.
Can anyone help we get started?
Can anyone show me a way to do it with formgen and a custom script adapter?
Go into your ZMI, and add a "Z Search Interface" object in the same folder as your ZSQL method. Your ZSQL methods should show as "searchable objects". Select the ZSQL method you want, fill in the rest of the fields, and it will generate form and display page templates. Then modify the templates to taste.