Androidplot - getSeriesSet() and other methods in newer AndroidPlot versions - androidplot

I'm looking at this answer from another question and trying to test it out.
One problem I'm having is a couple of the methods seem to have changed in newer versions of Androidplot. For whatever reason I can't figure out what replacement methods I'm meant to use.
The methods in question are:
mPlot.getSeriesSet().iterator().next() //Cannot resolve getSeriesSet
ValPixConverter.valToPix //Cannot resolve ValPixConverter
widget.getXVal //Cannot resolve .getXVal
My ultimate goal is to be able to place markers on the graph traces
EDIT:
Ok I've figured getXVal/getYVal gets replaced with screenToSeriesX/screenToSeriesY, the rest are still unknown :(

I eventually figured it out :)
mPlot.getSeriesSet().iterator().next() gets replaced with plot2.getRegistry().getSeriesList().iterator().next()
getXVal & getYVal gets replaced with screenToSeriesX & screenToSeriesY
For ValPixConverter I just copied the class from an older version of Androidplot.
This was enough to get me playing around with placing markers/cursor on the graph but a better solution will be formulated for the future.

Related

Processing insists pause() is not a function, when it very much is

Aite, [first poster here, pls don't bash]
So, I'm using the sound library, which I of course remembered to import, and works just fine, proof being given by the fact that all the other functions I used work as expected and give no problems neither in editor nor in execution.
Except, of course, for this little bugger of a pause() function, which I wrote as per below using no different a syntax from all the other functions, only to find out Processing isn't very keen on accepting its existence.
Problem shows both using 3.3.6 and 3.5.
Oh, and also, apparently isPlaying() returns an int, what's up with that?
If, as I'd suspect, that single line below won't be enough code to couple with the info to get to the bottom of it, here's a Dropbox link to the code (since it uses a bunch of files) so you can test it yourself.
It kinda won't work if you try to run it as is tho because it messes up when trying to load all the songs (in the last line of setup), yeah I kinda need some help with that too... works fine if you only load the first one tho!
https://www.dropbox.com/sh/di7mwit0w2l4513/AABipGDAdoKx277f8Hg_ZfhDa?dl=0
(Please, don't expect clear, extensively commented coding. I started working on this way before I learnt that was a thing. Deeply sorry. Of course, you can ask away about anything baffling you)
What did I try, er, writing it well???
I used .play(), .stop(), the volume ones, and they all, as per stated, work fine.
import processing.sound.*;
SoundFile[] songs= new SoundFile[1];
void setup(){
songs[0]=new SoundFile(this,"Small Bump.mp3");
songs[0].play();
}
void draw(){
}
void keyPressed(){
if (songs[0].isPlaying()==1)songs[0].pause();
}
When I copy your code into my Processing editor, I get a couple errors:
songs[0]="Small Bump.mp3";
The sounds array holds instances of SoundFile, but you're trying to store a String value here. Maybe you're looking for the SoundFile constructor?
if (songs[0].isPlaying()==1)
The isPlaying() function returns a boolean value, but you're comparing it to an int value.
songs[i].pause();
You haven't declared this i variable anywhere. Probably meant for this to be a 0.
If I fix all of these errors, then your code compiles fine.
You might want to take a look at the reference for the Sound library here.
The Sound library I had installed was 1.3.2, or something of the likes.
All the references I'd read were for 2.0+.
Having updated that through the "add library" menu, all was solved.

PHP framework AMPHP/THREAD no longer in use?

Was amphp/thread discontinued? amphp/amp is working perfectly but when I run ANY of the example coding from amphp/thread git, I get all kinds of errors. Not one example is working. I noticed last update was in 2014.
Is there any way for me to get amphp/thread working? Was it replaced? With what replacement?
I have php 7.0 installed on mac, built with thread safety. EV, EVENT, UV are all enabled.
My .jason file looks like this 
"amphp/amp": "v0.17.0", "amphp/thread": "v0.8.1"
Much appreciated.
I found the answer to this question in a discussion here:
https://github.com/amphp/thread/issues/14
amphp/thread is no longer being supported but there is hope that it will be picked up again in the future to work with amphp/amp v2. No concrete timeline on when this will happen was given.
Also, amphp/parallel is considered to be the replacement for amphp/thread.

Negative dp when using Configurator in AndroidPlot

I'm using AndroidPlot and have an issue trying to use a negative value in an XML file.
I'm having this property:
androidPlot.graphWidget.domainLabelHorizontalOffset="-20dp"
And when trying to configure it, it crashes...
Configurator.configure(getActivity().getApplicationContext(), gapFormatter, R.xml.gap_formatter);
The bug seems to come from PixelUtils that uses this pattern:
private static final Pattern DIMENSION_PATTERN = Pattern.compile("^\s*(\d+(\.\d+))\s([a-zA-Z]+)\s*$");
I think that adding a simple "-?" behind the "^" should resolve the problem, but I have many static final method and their classes to override...
private static final Pattern DIMENSION_PATTERN = Pattern.compile("^\-?\s*(\d+(\.\d+))\s([a-zA-Z]+)\s*$");
Does someone have a simple workaround to put some negative dip, please ?
Best regards,
Unfortunately there is no workaround available in 0.6.1. A bug report has been created to track the problem and will be resolved in the next release. I'll update this answer once the fix is available.

PCL Visualizer demo interaction customization crashing on spinonce

I'm trying to get the PCL Visualizer demo examples to work (all code here: http://pointclouds.org/documentation/tutorials/pcl_visualizer.php) for Windows, PCL 1.6, 32 bits version.
It works fine except for the Interaction Customization part, which is ironically the one i'm most interested on. An unhandled exception occurs at the spinOnce(100) line on the main method. From the long search I've done, it looks like it is deeply connected to VTK not being thread safe and keyboard/mouse callbacks interfering with the VTK window. However, I don't think I've completely understood this and could be mistaken. I have found a very similar question here in stackoverflow (using "pcl::visualization" in different threads from different instance of a class) and I tried using scoped_locks around the spinonce, as he suggests, but I think I'm not doing it right.
Has anyone managed to fully use this example on win32? For reference, here is my poor attempt at locking the spinonce:
while (!viewer->wasStopped ())
{
boost::mutex vis_mutex; //storage for static lock
boost::mutex::scoped_lock lock(vis_mutex);
viewer->spinOnce ();
boost::this_thread::sleep (boost::posix_time::microseconds (100000));
}
Thanks in advance!
I am afraid that it may be related to the version of PCL.
Tutorials are made to match latest versions of PCL and since 1.6 things might have changed.
I recommend you to update to the latest PCL from github. (actually I use code from this tutorial on win64 right out of the box, no issues)

Where did HttpProviders go in IAppHost?

I'm having problems in a project that runs on the v3.9.0.0 version of servicestack.
So I'm trying to download source for it. But on github there are no tags so it seems I cant get hold of the source. So... I downloaded the latest stack and the source for that.
Obviously I'm getting some deprecated warnings but except for that the compiler seems happy enough except for in one place
public virtual void Configure(IAppHost appHost, Container container)
{
appHost.HtmlProviders.Add(new HtmlProvider().ProcessRequest);
The compiler complains that IAppHost does not have a property HtmlProviders
Like so:
ServiceStack.WebHost.Endpoints.IAppHost does not contain a definition for HtmlProviders and no extension method 'HtmlProviders' accepting a first argument of type ServiceStack.WebHost.Endpoints.IAppHost could be found (are you missing a using directive or an assembly reference?)
I can't find anyone mentioning this missing so I'm guessing I'm missing something but what.
So at the end I guess the questions are:
Does anyone know how to get the source for the v3.9.0.0 version of servicestack?
Does anyone know what to do to migrate from v3.9.0.0 to current 3.x version considering the above HtmlProviders problem?
(I edited this post as I misread the version number at first)
Checking history for IAppHost your probably looking for roughly v3.94, about 10 months ago. How to upgrade to latest version? I'd suggest migrating a single service to the new API and going from there.

Resources