How can I dump the view hierarchy from within an Apportable app? - apportable

Using the Apple private API, [view recursiveDescription] returns nil on Apportable, how can I dump the view hierarchy? Is it possible, short of building it by hand?

From gdb : print [[[UIApplication sharedApplication] keyWindow] dumpGeometry:0] will output the hierarchy to logcat.
Also to use Android's hierarchyviewer:
Build with VIEW_SERVER=yes (or use 'google' labeled Nexus 7)
Start hierarchyviewer (.apportable/toolchain/macosx/android-sdk/tools/hierarchyviewer)

Related

CR2 Preview generation with Node.JS/Electron

I want to build a Node.JS/Electron ApplicationCache, that can show Previews for the following filetypes: DNG, CR2, JGP, TIFF.
I have accomplished all of that using an external library. Except for CR2.
I cant find anything (free) that can generate a preview image for CR2-Files and does not require installing exiftools or imagemagick on the machine. Does anybody have an idea waht it can use?
The solution to this problem is: dcraw

Can Xamarin Ios storyboard file get App version from Info.plist?

I want to show app version at splash screen.
I Searched how can get version from Info.plist and found this.
Ojbect-C
NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey: #"CFBundleShortVersionString"];
swift
let version: String! = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as String
I thought storyboard file maybe wrote by object-c or swift.
But it was xml...
I have no idea how can i do this.
I found this
How do I display the CFBundleShortVersionString in my LaunchStoryboard?
But sorry..I couldn't understand.
No more simple solution? If it impossible, I will have to change Info.plist and storyboard file every time update application.
I did with android this simply, Just made SplashActivity.cs file include a Label. Then add text like this.
FindViewById<TextView>(Resource.Id.lblAppVersion).Text = $"Version {PackageManager.GetPackageInfo(PackageName, 0).VersionName}";
If you know solution, please teach me. Thank you.

map inclusion file for skobbler sdk

I am trying to understand how to download offline maps from osm.
Eg jamaica.osm and use in skobbler for android. But so for i am confused.
The only they provided was this,
public void downloadMapsXMLForVersion(int version) {
String url = SKPackageManager.getInstance().getMapsXMLPathForVersion(version);
// … Download the xml from the URL … //
// … When download is finished call [downloadPackages] … //
}
I really don't understand.
All i simply want is to download an osm map file and load it into map view.
Thank You!
The Skobbler SDK uses .skm as a map format, which is an internal, proprietary format, so you can't use .osm
For download, on a device, start the demo project - go the “Map download” menu, navigate to North America -> Jamaica and proceed to download the map.
On the device you should now be able to find the downloaded package on: /Android/data/com.skobbler.sdkdemo/files/SKMaps/PreinstalledMaps/v1/20160426/package ) (you can search for .skm files to make things easier)

Deploy and load a picture to use as a texture in a holographic app

I created a sample holographic application in Visual Studio 2015 with C++/CX (or whatever they call that fancy C++ with hats and ref new). It builds, deploys and runs fine, rendering a rotating colored cube, just as it's supposed to. Now I am trying to add a jpeg image and use it as a texture on the cube. The question is, where shall I put the image, how do I add it to the project, how do I make VS to deploy it along with the rest of the project, and how do I load it in my application?
I have literally zero experience with both DirectX and UWP. I've done this tutorial on textures on my desktop Windows 10 (a regular C++ app, not managed, not UWP), although the way they load a file into a texture in the tutorial didn't work for me. After some googling I downloaded this library, built it for desktop Windows 10 (DirectXTex_Desktop_2015_Win10.sln) and used in my project as follows:
DirectX::ScratchImage image;
LoadFromWICFile(L"myimage.jpg", DirectX::WIC_FLAGS_NONE, nullptr, image);
CreateShaderResourceView(d3d11Device, image.GetImages(), image.GetImageCount(), image.GetMetadata(), &CubesTexture);
It worked. Now, for Hololens I built their DirectXTex_Windows10.sln solution (assuming that if the other one was for desktop, this one must be for non-desktop) and tried (unsuccessfully) using it like this:
DirectX::ScratchImage image;
HRESULT hr = LoadFromWICFile(L"ms-appx:///myimage.jpg", DirectX::WIC_FLAGS_NONE, nullptr, image);
CreateShaderResourceView(m_deviceResources->GetD3DDevice(), image.GetImages(), image.GetImageCount(), image.GetMetadata(), &m_cubesTexture);
I also tried ms-appdata instead of ms-appx. In both cases LoadFromWICFile does not return S_OK. It gives ERROR_INVALID_NAME: The filename, directory name or volume label syntax is incorrect. As for myimage.jpg, I put it into the Assets subfolder and added to the solution through Add->Existing Item. Is that enough to get it deployed to Hololens? How do I check if it gets deployed? Where on the device is it going to be located, if deployed?
It seems I over-complicated things.
To add a file like that into a project, simply use right click (on the Assets sub-folder in the solution explorer) -> Add -> Existing Item. To get it deployed on the device or emulator, right click on the file -> Properties, set Content to Yes and Item Type to Image or Does not participate in build (for something that doesn't get recognized correctly, for example, Wavefront .OBJ file, which VS would otherwise try and fail to link).
To check if (and where) the file is going to be on the device or emulator, you can build an actual package: right click on the project, choose Store->Create App Packages... It creates an .appx file, which is actually a zip-archive. You can explore it with an archiver like 7zip, or rename it from .appx to .zip and open with Windows File Explorer. In my case the image file was there, in the Assets subfolder. I was able to read it by its simple relative path, like this (no ms-appx:/// or other such prefixes):
HRESULT hr = LoadFromWICFile(L"Assets/myimage.jpg", DirectX::WIC_FLAGS_NONE, nullptr, image);
For some other functions (std::fopen, std::ifstream etc.) this relative path didn't work, I had to use the full path as follows:
Platform::String^ appInstallFolder = Windows::ApplicationModel::Package::Current->InstalledLocation->Path;
std::wstring folderNameW(appInstallFolder->Begin());
std::string folderNameA(folderNameW.begin(), folderNameW.end());
std::string fname = folderNameA + std::string("/Assets/model.obj");
std::FILE *f = std::fopen(fname.c_str(), "r");
This textured cube project might give you some insight. I think is based on the C# VS2015 Holographic template.
https://github.com/dngoins/HololensDXTutorials

Sketch Plugin - NSFileManager contentsOfDirectoryAtPath - not a function

I'm trying to make a plugin for Sketch that allows me to automate the production of multilingual assets.
Right now, I select a list of languages files that kick off the process. I use NSOpen Panel to select these. For each language file, it makes a new page for that language, and finds text layers with a special tag and replaces the copy with the translated copy.
While it's doing this, I'd like it to check to see if there are any screenshots in another folder screenshots/lang, and store a list of the filepaths for those images. This is where I'm getting stuck at the moment.
Currently I have:
var screenShotPaths = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:mySourcePath error:NULL];
When I try to run my Plugin in sketch in its current state, the console is saying:
(Sketch Plugin)[6547]: TypeError: fileManager.contentsOfDirectoryAtPath_ is not a function.
(In 'fileManager.contentsOfDirectoryAtPath_( mySourcePath)', 'fileManager.contentsOfDirectoryAtPath_' is undefined)
I've tried looking all over I see a lot of issues where the list isn't coming back,coming back null, etc, but I can't find anything where contentsOfDirectoryAtPath is coming back as not a function.
Is this because it's a plugin getting run by an application and navigating the filesystem is a security issue?
Any help would be much appreciated. Thank you!
A little late to the game here, but hopefully someone searching for this will find this useful.
I found that you have to use the full method: contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error(url,nil,nil,nil);
I'm more familiar with JS so I'm using js syntax. Hopefully someone else can translate this to Cocoa.
Works for me: (Sketch 55)
var fileManager = [NSFileManager defaultManager];
var paths = [fileManager contentsOfDirectoryAtPath:filePath error:null];

Resources