Waze deeplink, what is the meaning of setting *both* Q & LL parameters? - waze

When launching Waze deeplink -
What is the meaning of setting both Q & LL parameters?
For example:
https://waze.com/ul?q=66%20Acacia%20Avenue&ll=45.6906304,-120.810983&navigate=yes vs.
https://waze.com/ul?ll=45.6906304,-120.810983&navigate=yes
Documentation isn't clear about it and it looks like the same behavior:
https://developers.google.com/waze/deeplinks#combining-parameters

Related

Call an app in a loop with different parameters in Cytoscape

I'm new in Cytoscape. I want to know how can I run an app (for example MCL clustering algorithm) multiple times with different parameters in Cytoscape. Is there any way to write an script to do that instead of running manually multiple times for different parameters?
Thanks!
Thanks Scooter.
I saw his answer.
Still I have problem with MCODE.
I figured it out by reading this paper "Cytoscape Automation: empowering workflow-based network analysis".
I want to put the script here in the case that maybe somebody has question.
From python you need to import
import requests, json
import numpy
REST_ENDPOINT = 'http://localhost:1234'
and then let's say we want to use affinity propagation clustering algorithm, then you can go to help->Automation->CyRest command API. Here you can find the app and all its parameters. You load the input network from cytoscape in the beginning.
counter = 0
ap_clusters = dict()
for i in numpy.arange(-1.0, 1.1, 0.1):
message_body = {
"preference": str(round(i,1))
}
response = requests.post(REST_ENDPOINT + '/v1/commands/cluster/ap', data =
json.dumps(message_body), headers = {'Content-Type': 'application/json'})
response_data = response.json()['data']
ap_clusters[counter] = response_data['clusters']
counter += 1
above is a code to call AP clustering multiple times from python.
For AP and MCL the code works for multiple parameters. However when I tried to call MCODE with different set of parameters, it stopped the connection and closed the cytoscape app. It can only run for on set of parameters.
This is the error:
" raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))"
here is the code for mcode algorithm:
counter = 0
mcode_clusters = dict()
for i in numpy.arange(3,6,1):
for j in numpy.arange(0.1,0.56,0.05): #----vertex weight percentage
for h in ["on","off"]:
for f in ["on","off"]:
if f=="on":
for p in [0,0.1,0.2]: #---fluffing percentage
message_body = {
"fluff" : f,
"fluffNodeDensityCutoff" : str(round(p,1)),
"haircut" : h,
"maxDepthFromStart" : str(i),
"nodeScoreCutoff": str(round(j,1))
}
response = requests.post(REST_ENDPOINT + '/v1/commands/cluster/mcode', data = json.dumps(message_body), headers = {'Content-Type': 'application/json'})
response_data = response.json()['data']
mcode_clusters[counter] = response_data['clusters']
counter += 1
If you have any solutions I really appreciate it if you could share it with me.
Thanks.
SaRa
I think this was answered by Ruth pretty clearly in cytoscape-helpdesk:
You can do all of the above. Whatever is easiest for you.
There is a library py2cytoscape that you can use to issue commands to cytoscape from > python. Info can be found here: https://py2cytoscape.readthedocs.io/en/latest/
for more info on automation in cytoscape check out: http://manual.cytoscape.org/en/stable/Programmatic_Access_to_Cytoscape_Features_Scripting.html
But you can also run it through automation. You can create a text file with each of > your commands (for example a list of commands like: cluster mcl attribute="correlation" network=1234") and then go to Tools --> execute batch file to > execute the whole file. I am not sure if support loops. If you want to loop through anything I would recommend using python.
Thanks,
Ruth
I'll just add that currently, looping isn't supported in batch files.
-- scooter
In regard to my problem, I have to say that:
There are two mcode in cytoscape. One is in clusterMaker and the other belongs to cytoscape. When I tried to call mcode, I used the command "'/v1/commands/cluster/mcode'" I called the one in clusterMaker however the parameters' name was based on the one in cytoscape. I changed the command to "'/v1/commands/mcode/cluster'" and the the problem is solved now.
Many thanks.
SaRa

How to enable/disable a particular bbappend for a specific MACHINE in Yocto

I'm trying to understand the mechanism Yocto provides to enable/disable a particular bbappend for a specific MACHINE. I read this link (Modifying Variables to Support a Different Machine):
https://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers
And also found some information related here on stack overflow:
Machine specific layers in yocto
I have tried putting all this information into practice without any success. This is my particular problem:
A BSP layer for an "x" platform provides a qtbase_%.bbappend that modifies qtbase recipe from meta-qt5. I need this qtbase_%.bbappend only applying when building for MACHINE="x", but not for other different machines.
This is the content of the original qtbase_%.bbappend defined on the x-bsp-layer:
PACKAGECONFIG_GL = "gles2"
PACKAGECONFIG_FONTS = "fontconfig"
PACKAGECONFIG_APPEND = " \
${#bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove = "evdev"
Whenever I try to build an image for a MACHINE different from "x", the compilation is broken:
| ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.
| ERROR: Feature 'eglfs' was enabled, but the pre-condition '!config.android && !config.darwin && !config.win32 && features.egl' failed.
| ERROR: Feature 'gbm' was enabled, but the pre-condition 'libs.gbm' failed.
Removing the x-BSP-layer from bblayers.conf solves the problem, but that's not the kind of solution I am looking for.
I tried fixing this using information provided in previous links. I modified qtbase_%.bbappend recipe in this way:
PACKAGECONFIG_GL_x = "gles2"
PACKAGECONFIG_FONTS_x = "fontconfig"
PACKAGECONFIG_APPEND_x = " \
${#bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append_x = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend_x := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove_x = "evdev"
As you can see, I appended the "_x" suffix to all recipe variables. It's supposed (at least that it's what I understand) those "_x" make the variable being assigned just in case the PLATFORM="x" is defined. Right? But it doesn't work as expected, it generates the same problem. So, in practice, this means I don't understand even the basics of this mechanism.
Can some of you provide a good explanation for this? I think it should be helpful for others with the same issue out there. Thanks a lot for your time! :-)
Just add COMPATIBLE_MACHINE = "x" in .bbappend file.
As you can see, I appended "_x" suffix to all recipe variables
Remove all "_x" suffix in .bbappend file.
Note adding COMPATIBLE_MACHINE as suggested would change the signatures of the original recipe, which is bad practice, and would result in your layer failing the compatibility test carried out by the yocto-check-layer script. Consult this for details.
The correct way of making a .bbappend file machine-specific is through overrides, as you're already doing in your proposal. Why it still fails is a different question. I suggest you to inspect the variables of the recipe through bitbake, and switch machines to verify they change accordingly.

How to detect browser in Elm

How do I detect the browser from Elm?
Specifically I want to be able to tell if the web app is running on a tablet (Safari on iPad, etc.) or not.
You can use Html.programWithFlags to pass information from Javascript to Elm on initialization.
Assuming you can infer browser from user agent, you could do something like this:
type alias Flags =
{ userAgent : String }
Your init would look like this:
init : Flags -> ( Model, Cmd Msg )
init flags =
...
main =
programWithFlags { init = init, ... }
And from Javascript, you would pass the flags in like this:
var app = Elm.Main.fullscreen({
userAgent: navigator.userAgent
});
Side note: User agent may not be enough to fully detect browser. You can see this StackOverflow answer which provides more reliable detection. Either way, the end result is that you would send some kind of flag along to the Elm app on init.
More info on Flags can be found here.
You can use elm-vendor package.
http://package.elm-lang.org/packages/coreytrampe/elm-vendor/latest

Specifying build parameters to FAKE

I am essentially asking for an update to date answer to the already answered question: Can I pass a parameter to a F# FAKE build script?
Here is build.fsx
let revisionNumber = getBuildParamOrDefault "rev" "123"
Target "Log" (fun _ ->
trace ("Revision Number: " + revisionNumber)
)
RunTargetOrDefault "Log"
Output running Fake.exe .\build.fsx:
Perfect!
Output running Fake.exe .\build.fsx rev=456 (as suggested by this answer: https://stackoverflow.com/a/26597179/2382536):
Starts with
But at the bottom gives the correct result:
What format do I need to pass the parameters in to get rid of the warning message?
Passing parameters is done using the --envvar parameter. Until recently you can just add parameters in a way you did after the build target but not anymore. I believe this was changed in order not to confuse build parameters with (optional) build target name.
So, try this:
fake build.fsx Push --envvar rev 456
I just want to share the link to the official documentation:
TLDR:
You can either use
--envvar [-ev] <name:string> <value:string>
to set a variable to a custom value, or
--envflag [-ef] <name:string>
to set a variable to true, or
--fsiargs --debug+ buildscript.fsx someArg1 anotherArg2
to pass all arguments (including build script name, importent!) direcly to fsi.exe

How to tell if a given path is mounted removable media in Mac OS X?

Given a path, in Mac OS X, is there a way to tell that it is a mounted CD or DVD, as opposed to a regular directory, a regular file, or mounted DMG or other mountable file type? Specifically I would like to know if it is a CD or DVD when a user supplies a path directly, or via the NSOpenPanel, or drags the CD onto the app. I need to take special action in these cases.
Check out Apple's VolumeToBSDNode example code. I believe it should have the code bits you need.
Description
Shows how to iterate across all mounted volumes and retrieve the BSD node name (/dev/disk*) for each volume. That information is used to determine if the volume is on a CD, DVD, or some other storage media.
As Kent points out, the PBHGetVolParmsSync call in this example is deprecated. Here's a diff to use the newer function:
- HParamBlockRec pb;
- // Use the volume reference number to retrieve the volume parameters. See the documentation
- // on PBHGetVolParmsSync for other possible ways to specify a volume.
- pb.ioParam.ioNamePtr = NULL;
- pb.ioParam.ioVRefNum = actualVolume;
- pb.ioParam.ioBuffer = (Ptr) &volumeParms;
- pb.ioParam.ioReqCount = sizeof(volumeParms);
-
- // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field.
- // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h.
- result = PBHGetVolParmsSync(&pb);
+ // Use FSGetVolumeParms instead of the deprecated PBHGetVolParmsSync
+ result = FSGetVolumeParms(actualVolume, &volumeParms, sizeof(volumeParms));
+