Root on Android Things userdebug builds - root

In my Android Things app, I need to use su from runtime. However, Android Things system is built as userdebug build, so I can only access it from adb. I tried to both replace su binaries with no luck. I tried to disable ro.secure by unpacking and repacking boot.img, however flashed system still returns getprop ro.secure 0. How can I achieve root in my Android Things device?

I had these scripts working on a quite early preview version, maybe 0.1 or 0.2. https://github.com/fmatosqg/androidthings_ndk/tree/master/app/src/main/script
Although I had to run it manually, there should be a place where I can add this script so it runs every boot, just like linux's /etc/rc.d
I don't remember how I got the script to work, but the idea is that one script simply exists to launch the other running as superuser, similar to what you would expect with sudo <insert command here>

Related

How to run angular 2 application?

I have downloaded angular 2 application from this link:
https://github.com/aravindfz/firstAngular2App
How to run this application?
Which angular cli version install to run angular 2 application?
I tried from some questions stackoverflow but not working properly.guys this question is not duplicate..Please understand.
Anyone can give clear details?
I need step by step procedure.
If you cloned the repo and did nothing else, there are a few things you need to do before you can run the app. Since I don't know how much web development you have done, I'm going to include things some people will think unnecessary.
Install node.js, if you haven't yet. Grab the LTS release from https://nodejs.org/en/. Do not use the "Current" version, because that may not be compatible with Angular just yet. If you have and older version of Node, upgrade. If you already have the LTS version, skip this step.
Now open a new command prompt or terminal and change to the directory where you cloned the repo. To be sure you're in the right place, make sure you can see a file named package.json.
In this command prompt/terminal window, execute this command: npm install. This will download and install all the dependencies (which could rather disturbingly add up to a few hundred Megabytes). You may experience timeout errors if you're behind a corporate proxy server. That's not something you can fix as of 2018. Just connect using something else and try again.
Once everything is installed, you should be able to run the Angular app. Everything I mentioned already only need to be done before you run it the first time. To ensure you are in the right folder, navigate to where your index.html is located and run this command: ng serve. If ng cannot be found, you may need to install it. To do so, execute npm install --save-dev #angular/cli. Now it should work. If not, close your command prompt/terminal window, open a new one and try ng serve again.
Once ng serve is finished compiling, you should be able to view your app by opening http://localhost:4200 in your favourite browser.
And that's it!
Here's a bonus tip: Take the time to work through the official Angular Quick Start. It really is a fantastic guide and will get you skilled up much quicker than just hacking it ever will.
Good luck.

Console isn't showing up when running print() using LOVE2d with atom-editor

Using atom-editor 1.13 with the love-ide package installed to run LOVE2d 10.2 games (windows 7)
Apparently if you create a conf.lua file in the same folder as your main.lua file you can add some configuations to main.lua. So, I've got these lines of code in my conf.lua to show console.
function love.conf(t)
t.console = true
end
But when I go back to my main.lua and type print("ballz"), all I see is a blank LOVE2d game screen with no extra console window. Not really sure if this is because I'm using atom editor or not. Everything seems to be PATH'ed correctly.
On a side note, whenever I run atom using the love-ide package it always tries to install some "dependecy files" like the hyperclick-love package, and the auto-complete-love package. These fail to install because I don't have git installed.. honestly I really don't know what git is, but neither it, hyperclick, or auto-complete seemed like requirements to run my game, so in the spirit of not installing unnecessary things onto my computer I never installed these things... annoying as it is to see this notification always pop up when I start atom. Anyone know if this is contributing to the issue, or know a way to remove these notifications or auto-download-attempts? My LOVE2d code still seems to run without these packages.
Have you set up the terminal emulator in your configuration?
(Windows only) Try using the lovec.exe executable instead of the normal love.exe. The first one attaches to the console that executed the game, the second one ignores it.
Lua has a buffered output, try adding io.stdout:setvbuf('no') to the top of main.lua

Starting Meteor with Velocity test without the Chrome pop-up

In my quest to gather knowledge about how to use Velocity, I ran across a snippet that mentioned a shell variable to set the browser Velocity used to run Karma in PhantomJS as apposed to creating a Chrome window pop-up each time I run my app in DEV-mode. At the time I shrugged it off, but after having implemented some testing in two of my apps, I can say it's an annoying pain to have the tests running in a pop-up window.
Does someone know if how one might get the tests running such that they run in PhantomJS and not in a Chrome pop-up windows? I thought the variable was something like VELOCITY_BROWSER=PhantomJS, but that doesn't seem to work. Also, is there a way to setup Meteor so that it simply sets this as a default so I don't have to create the variable each time, like in a config or something?
I found the answer for those that find this and were also wondering how to prevent the Karma popup.
I am using the sanjo:jasmine test suite, which uses Karma for the client integration tests. You can set the default browser to PhantomJS by simply adding this to your environment when you run meteor:
JASMINE_BROWSER=PhantomJS
Or, if you just want to turn off client integration tests altogether simply adding this:
JASMINE_CLIENT_UNIT=0
So, for instance you can run your app like JASMINE_BROWSER=PhantomJS meteor, and you will not get the popup any longer. What I did was created a meteor.sh in my app root folder that I use to launch with environment variables like so:
#!/bin/sh
JASMINE_BROWSER=PhantomJS meteor
This is only for convenience so I wouldn't have to remember the variable to do this. This should work on any *nix-based OS. You could also make an alias if you wanted. It would look something like:
alias meteor=JASMINE_BROWSER=PhantomJS meteor
I may be slightly off in the syntax, but I think that should work.
To use PhantomJS you do need to have it installed, so run this in a terminal:
npm install -g phantomjs
Or, if you are on a Mac run (you will need brew installed):
brew install phantomjs
Hope this helps someone in the future.
In sanjo:jasmine 0.17.0 on Windows, PhantomJS has some issues with meteor's autoupdate feature. You may have problems with re-running tests when you change the app's code.
If you'd like to stick with Chrome window, it can be somewhat hid by using chrome's commandline options, but you'd need to update karma-chrome-launcher\index.js to include these:
return [
'--user-data-dir=' + this._tempDir,
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-translate',
'--window-position=-800,0', // <-- added
'--window-size=800,600' // <-- added
].concat(flags, [url])
The window will show up, but will be created off-screen, and somehow luckily doesn't even steal the keyboard focus.

QProcess::startDetached blocked by UAC (running an updater)

I have an update function in my app - it downloads and verifies the installer (a setup.exe, created with NSIS). To actually kick off the update, I have simply been doing:
QString path = .. absolute path to the downloaded file ...
QProcess::startDetached(path, QStringList());
This works fine on XP - but on Vista and Win7, nothing happens once the download completes. If I browse to the downloaded update and run it manually, it works fine. I assume what's happening is that UAC is blocking the installer at CreateProcess time, but this is where my knowledge runs out.
Additional complication - when I'm running a debug build from the command line, the steps above work - I get the UAC prompt and can run the installer. It's the release builds, started form the start menu/shortcut, which have the issue - I assume there's a difference in the auth token when running from a command shell.
You can also use
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
Might be surprising and counterintuitive, but it works and is more cross-platform
If you are not admin and you call CreateProcess() on a .exe with a "Vista" manifest (or no manifest, but a .exe that windows detects as an installer (This includes NSIS)) the call fails, you need to use ShellExecute[Ex](). ShellExecute will trigger UAC prompt if required...
This seems to be a Qt bug, see QTBUG-9761 , the correct workaround is to use ShellExecute with lpOperation set to runas.
Another alternative is to prepend your execution with cmd.exe /C. This effectively routes your execution through the shell, so you do get the UAC prompt. The downside is that if your process fails you probably won't get as much information had you gone through ShellExecute[Ex], but on the plus side you will get all the facilities of QProcess that you miss if you use QDesktopServices::openUrl, where you have no idea if things worked or not.

Compiling Flex Projects with Remote Ant

I'm having problems compiling applications with remote ant, something similar to this. However the flex compiler seems to have problems with this. When I run the same script on my local compiles everything without any problems but when I try the remote ant it fails without giving more information.
Things to look for on the remote machine:
The paths in the build file need to be valid (I'm pretty sure the script file you use to build the project on your computer, will not be good on the remote one because of a possible difference in paths)
You need the Flex SDK installed
You need Java JDK installed
You might also need some environment variables set correctly (like JAVA_HOME)
ANT binaries on the remote machine (but I assume you already have this, probably coming with the system you're using)
The sources to be compiled, obviously (I assume you already have these too, probably gotten by your system from a repository)
Also I find it hard to believe it would fail without any error. There should be at least a log file somewhere to give you an idea of what went wrong.

Resources