How to save ADF file to a network share? - google-project-tango

So, it looks like the best way to do this is with the exportAreaDefinitionFile() call. I thought I would just export the file to the local file system then manually send it to where I need it. However when I make the exportAreaDefinitionFile() call, I don't get a file in the local file system. When I handle the onActivityResult() for the export it gets a RESULT_CANCELED result every time. Does anyone know why this would occur? Everything I've seen online says it should work.
When I look at logcat I get these messages after the exportAreaDefinitionFile() Call:
I/tango_client_api: void TangoService_disconnect(): Disconnecting from Tango...
I/tango_client_api: void TangoService_disconnect(): Successfully disconnected from Tango.
Is this normal?

I figured it out!!
It turns out that the problem was I was using this:
String mapsFolder = getFilesDir() + File.separator + "ADFs";
When I should have been using this:
String mapsFolder = getFilesDir().getAbsolutePath() + File.separator + "ADFs";
This being my first ever Android app I have no idea why these two calls are functionally different. I still haven't wrapped my head around the Android file system.

Related

Bundleconfig (seemingly) not creating requested .js files

We have a large solution with a number of files being created by bundleconfig.cs. But for some reason the last two projects added to the solution don't seem to be getting the files creating. The pages that use them fail cause they aren't there, or not being found.
Example of project successfully getting the files created:
const string ANGULAR_APP_ROOT_EDI = "~/app/ediViewer/";
const string VIRTUAL_BUNDLE_PATH_EDI = ANGULAR_APP_ROOT_EDI + "main.js";
bundles.Add(
new ScriptBundle(VIRTUAL_BUNDLE_PATH_EDI)
.Include(ANGULAR_APP_ROOT_EDI + "ediViewerApp.js")
.IncludeDirectory(ANGULAR_APP_ROOT_EDI, "*.js", searchSubdirectories: true)
);
Example of one that's not:
const string ANGULAR_APP_ROOT_EDI_SC = "~/app/SupplyChain/";
const string VIRTUAL_BUNDLE_PATH_EDI_SC = ANGULAR_APP_ROOT_EDI_SC + "main.js";
bundles.Add(
new ScriptBundle(VIRTUAL_BUNDLE_PATH_EDI_SC)
.Include(ANGULAR_APP_ROOT_EDI_SC + "SupplyChainApp.js")
.IncludeDirectory(ANGULAR_APP_ROOT_EDI_SC, "*.js", searchSubdirectories: true)
);
very similar, both Angular(js) projects with similar directory structures. but the second one gets no files. I have other projects with a similar structure that are working.
I was hoping there was a way to put breakpoints in the bundleconfig file to see if if it was hitting the code, but apparently you can't, or I didn't successfully set one up.
There are a number of bundles appearing after the new one (the standard Angular libraries) that are getting created, so it doesn't appear to be stopping in the middle or anything.
The workaround was I simply added the scripts needed manually to the aspx page, but I shouldn't have to. It's happened for two new projects so far, so I'm prepared to bet it may happen for a third, so if I can find a fix it'd be useful.
Any ideas what might be happening, or how I can troubleshoot it?

Getting the filename/path from MvvmCross Plugins.DownloadCache

I'm currently using MvvmCross DownloadCache -- and it's working alright -- especially nice when I just need to drop in an Image URL and it automagically downloads / caches the image and serves up a UIImage.
I was hoping to leverage the code for one other use case -- which is I'd like to grab source images from URL's and cache the files on the local file system, but what I really want for this other use case is the image path on the local file system instead of the UIImage itself.
What would help me most if I could get an example of how I might accomplish that. Is it possible to make that happen in a PCL, or does it need to go into the platform specific code?
Thanks -- that works, but just in case anyone else is following along, I wanted to document how I got the Mvx.Resolve<IMvxFileDownloadCache>() to work. In my setup.cs (in the touch project), I had:
protected override void InitializeLastChance ()
{
Cirrious.MvvmCross.Plugins.DownloadCache.PluginLoader.Instance.EnsureLoaded();
Cirrious.MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded();
Cirrious.MvvmCross.Plugins.Json.PluginLoader.Instance.EnsureLoaded();
...
}
But that wasn't enough, because nothing actually registers IMvxFileDownloadCache inside the DownloadCache plugin (which I was expecting, but it's just not the case).
So then I tried adding this line here:
Mvx.LazyConstructAndRegisterSingleton<IMvxFileDownloadCache, MvxFileDownloadCache>();
But that failed because MvxFileDownloadCache constructor takes a few arguments. So I ended up with this:
protected override void InitializeLastChance ()
{
...
var configuration = MvxDownloadCacheConfiguration.Default;
var fileDownloadCache = new MvxFileDownloadCache(
configuration.CacheName,
configuration.CacheFolderPath,
configuration.MaxFiles,
configuration.MaxFileAge);
Mvx.RegisterSingleton<IMvxFileDownloadCache>(fileDownloadCache);
...
}
And the resolve works okay now.
Question:
I do wonder what happens if two MvxFileDownloadCache objects that are configured in exactly the same way will cause issues by stepping on each other. I could avoid that question by changing the cache name on the one I'm constructing by hand, but I do want it to be a single cache (the assets will be the same).
If you look at the source for the plugin, you'll find https://github.com/MvvmCross/MvvmCross/blob/3.2/Plugins/Cirrious/DownloadCache/Cirrious.MvvmCross.Plugins.DownloadCache/IMvxFileDownloadCache.cs - that will give you a local file path for a cached file:
public interface IMvxFileDownloadCache
{
void RequestLocalFilePath(string httpSource, Action<string> success, Action<Exception> error);
}
You can get hold of a service implementing this interface using Mvx.Resolve<IMvxFileDownloadCache>()
To then convert that into a system-wide file path, try NativePath in https://github.com/MvvmCross/MvvmCross/blob/3.2/Plugins/Cirrious/File/Cirrious.MvvmCross.Plugins.File/IMvxFileStore.cs#L27

Calling checkCurrentDictionary() from addon crashes FF - why?

I'm tyring to call the method checkCurrentDictionary() of nsIEditorSpellCheck from within an add-on. The relevant code I use is:
var editorSpellCheck = Cc["#mozilla.org/editor/editorspellchecker;1"].createInstance(Ci.nsIEditorSpellCheck);
editorSpellCheck.checkCurrentDictionary();
This immediately crashes the Fx. What is going wrong here?
So this probably has something to do with the fact that nsIEditorSpellCheck is not a scriptable interface.
Basically, a scriptable interface is one that can be used from JavaScript.
If you want to access the spell check service you can do something like:
let editor = editableElement.editor;
if (!editor) {
let win = editableElement.ownerDocument.defaultView;
editor = win.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIWebNavigation).
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIEditingSession).
getEditorForWindow(win);
}
if (!editor)
throw new Error("Unable to find editor for element " + editableElement);
(The above is from http://dxr.mozilla.org/mozilla-central/source/editor/AsyncSpellCheckTestHelper.jsm which is MPL).
Then you can use the InlineSpellCheck.jsm to do some crazy stuff.
I'm not sure what you want to do though, so perhaps you should ask that more specific question as a new question.

How do I set XAConnectionFactoryEnabled in WLST Offline Mode

I am trying to set up a JMS queue in Weblogic to be transactional. This requires enabling XA on the connection factory I am using.
I know I can do this from the admin console once weblogic is up and running. However, I really need to do it in offline mode while the domain is being created. Right now I have this:
#*Setting up resources and JDBC*
cd('/')
create('JMSServer-0', 'JMSServer')
cd('/')
create('JMSQueues', 'JMSSystemResource')
cd('JMSSystemResource/JMSQueues/JmsResource/NO_NAME_0')
queue=create('AQueue', 'Queue')
queue.setJNDIName('jms/AQueue')
queue.setSubDeploymentName('subdeploymentA')
queue=create('BQueue', 'Queue')
queue.setJNDIName('jms/BQueue')
queue.setSubDeploymentName('subdeploymentB')
connFact=create('AConnFact', 'ConnectionFactory')
connFact.setJNDIName('jms/AConnFact')
connFact.setSubDeploymentName('subdeployment_fact_A')
connFact=create('BConnFact', 'ConnectionFactory')
connFact.setJNDIName('jms/BConnFact')
connFact.setSubDeploymentName('subdeployment_fact_B')
cd('/JMSSystemResource/JMSQueues/JmsResource/NO_NAME_0/ConnectionFactory/BConnFact')
tp=create('BConnFactTp', 'TransactionParam')
tp.setXAConnectionFactoryEnabled(true)
#TransactionParam does not show up here
print "\n" + pwd() + "\n"
ls()
#TransactionParam DOES show up here
cd('/JMSSystemResource/JMSQueues/JmsResource/NO_NAME_0/ConnectionFactory/AConnFact')
print "\n" + pwd() + "\n"
ls()
#Finalization follows here
Now, this is an existing script and AConnFact and AQueue have been around for awhile with XA disabled, so I'd prefer to leave them alone. So, how do I make it so that BConnFact is actually the one that gains the new TransactionParam settings?
I should note that I do have a "meh" fix to this. Create will place the TransactionParams in the order that the ConnectionFactories are created. I can just place them in the order I want. However, I would prefer not to do that.
See if something like the following example will work for you:
cd('/JMSSystemResources/MyModule/JMSResource/MyModule')
cmo.createConnectionFactory('MyConnFac')
cd('/JMSSystemResources/MyModule/JMSResource/MyModule/ConnectionFactories/MyConnFac')
cmo.setJNDIName('jms/MyConnFac')
cmo.setSubDeployment('my_sub')
cd('/JMSSystemResources/MyModule/JMSResource/MyModule/ConnectionFactories/MyConnFac/TransactionParams/MyConnFac')
cmo.setTransactionTimeout(3600)
cmo.setXAConnectionFactoryEnabled(true)
Works for us in 10.3.6
Edit: Ah probably. If you really need to do it offline and wlst isn't going to work you can manually edit your <domain home>/config/jms/<jms module>.xml file and add
<transaction-params>
<transaction-timeout>900</transaction-timeout>
<xa-connection-factory-enabled>true</xa-connection-factory-enabled>
</transaction-params>
under your connection factory.
This might be a bit outdated but in offline this works for 12.2.1:
connFact = create('PubSubSelectorsConnectionFactory','ConnectionFactory')
connFact.setJNDIName('jms/PubSubSelectorsConnectionFactory')
cd('/JMSSystemResource/PubSubSelectorsJMSModule/JmsResource/NO_NAME_0/ConnectionFactory/PubSubSelectorsConnectionFactory')
set('DefaultTargetingEnabled','true')
create('PubSubSelectorsConnectionFactoryTP', 'TransactionParams')
cd('TransactionParams/NO_NAME_0')
set('XAConnectionFactoryEnabled', 'true')

Programatically moving through a ListView in Qt (Ruby)

I'm making a small file-browser for my own use, in Ruby, and using Qt for the view. The idea is that it'll end up on my TV, where I can use the remote to move up and down and launch files.
Everything works fine, until I'm going to move the selection using the remote. I managed to set up a D-Bus service, so I'll just call the methods using LIRC.
The code I'm using for setting up the view looks like this:
#dm = Qt::DirModel.new
#sm = Qt::ItemSelectionModel.new(#dm)
#lv = Qt::ListView.new
#lv.model = #dm
#lv.selectionModel = #sm
cwd = #dm.index(#dir)
#lv.rootIndex = cwd
And then I'm unsure how to change the selection. Think I must have tried about every setIndex, setSelection and every method sounding similar, on the DirModel, ItemSelectionModel and ListView, without any luck. I've been googling and reading through the API without finding anything.
Ideally, I would have something like "moveSelectionDown" and "moveSelectionUp" that takes care of it, and making sure it wraps around correctly. But I can't seem to find anything.
Managed to fix it through the ItemSelectionModel every view apparently has.
moving up:
curIndex = #lv.currentIndex
#lv.selectionModel.setCurrentIndex(curIndex.sibling(curIndex.row-1, 0), Qt::ItemSelectionModel::ClearAndSelect)
or adding one to move down
I think you're forgetting that you have to create the ModelIndex through your model:
#dm.index(3, 0, None)
I'd try this method (Though I'm not really sure, this deselects the other cells.)
#lv.setCurrentIndex(#dm.index(3, 0, None))
I haven't used Ruby for ages, so I'm not exactly sure there's None.

Resources