The 'termux-battery-status' command in (Termux: API) does not work - android-9.0-pie

I want to know the current battery value on my phone, but I can not do this. When I enter the 'termux-battery-status' command, my terminal hangs (it doesn’t output anything).
I read on various forums about changing application settings Like this or like this.
My telephone:
$ termux-info
Packages CPU architecture: aarch64
Updatable packages: All packages up to date
Android version: 9
Kernel build information: Linux localhost 4.9.117+ #4 SMP PREEMPT Mon Jul 8 17:13:44 CST 2019 aarch64 Android
Device manufacturer: Blackview
Device model: A60Pro
Termux Settings:
I do not understand how to fix this. :/
Help me please.

Please install the Termux:API app on your device : https://play.google.com/store/apps/details?id=com.termux.api
After installation, head over to App Info for the Termux:API app, and allow all the permissions including Modifying System Setting.

Try termux-api-start command first. This is what helped me

RUN Termux-API in your phone in 2023
This will solve all the termux-api problems including Termux-battery-status issue.
Since Developers have stopped updating the playstore version of termux it is not going to work properly, so from now on we have to use termux from the f-droid website. Also, you need to install the termux-api.apk to make these api commands work. below is the simple code that can make everything work in few seconds
So firstly install termux application from F-Droid, Download link. If you are already using the F-Droid version, then skip this step.
Just copy the entire code directly and paste it inside your termux. it will open the termux-api page for you, just install it and everything will be fixed.
echo -e "\e[031m" "HEY, MAKE SURE TO INSTALL THE TERMUX API APP THEN
COME BACK AGAIN IN TERMUX" && sleep 2 && xdg-open
"https://f-droid.org/repo/com.termux.api_51.apk"&& echo -e '\e[032m'
'HAVE YOU INSATLLED TERMUX API APK? IF YESS THEN PRESS ENTER, IF NO
THEN RE-RUN THE SCRIP AND THIS TIME INSTALL THE APK IN YOU PHONE' &&
read r && pkg install "termux-api" && exit
type termux-battery-status to find the battery info.
To make everything work even smoother, go in your settings>apps> search Termux:API and make sure to allow every permission you can enable.

download termux api app from play store then you can easily use that commands its 200% true just try its only 2MB app

Related

How to update my Windows application package in wingetcreate

I have a little problem while I want to update my package. I'll explain this: I published my package. After that, I waited for 2-3 hours for my packages be in the microsoft/winget-pkgs in GitHub. My branch merged successfully, It works on any Windows devices but, I created a new version of my application: v3.6.2. The version that I released it was v3.5.7. So now, I can't publish that version because this error is showing when I execute this cmd command: wingetcreate update <packageIdentifier> -u https://github.com/YourUsername/yourrepository/releases/download/3.6.2/yourapp.exe --version 3.6.2 -t ghp_YourGithubPersonalAccessTokenWith_public_repo_setting.
If you want an image, i'll show you the image (My Windows is French btw): Here the image. But as you can see, the red is the error and I tried everything, I searched on Google and didn't find anything that fixed my problem, I tried the examples showed above when you only execute this command: wingetcreate.exe update but still the same error message that you can see on the image.
So I decided to take the third example but same, without success. Is there a way that could update my WinGet package? Thanks!
I don't know if this could help but I can give you some info: it's inno, the achitecture is Neutral.
IMPORTANT NOTE:
FIX HERE
The last answer works but if you type the command winget search <YourApp>, it will keep the previous version and if you install, it would install the previous one... How to fix that because it is litteraly NOT updating but doing nothing.
It's hard for me to know exactly what the issue is without knowing the contents of the manifest or the metadata of the installer. My gut feeling is that there is an architecture mismatch when trying to match the installer you provided with the existing installer that is currently specified in the existing manifest. To override the detected architecture you can use the '|' symbol followed by the desired architecture. Here is an example:
wingetcreate update <packageIdentifier> -u "https://github.com/YourUsername/yourrepository/releases/download/3.6.2/yourapp.exe|x64" --version 3.6.2 -t <githubToken>
If that doesn't work for you, I would encourage you to post an issue on the GitHub repository so we can help you further.
Okay, I found the way: You take the code that the previous answer contains, and add -s:
wingetcreate update -s <packageIdentifier> -u "https://github.com/YourUsername/yourrepository/releases/download/3.6.2/yourapp.exe|x64" --version 3.6.2 -t <githubToken>
It will publish the application on GitHub for verification, in the command prompt you put (replace the sentence in the quotes with your current manifest file):
winget validate --manifest "PathToYourManifestShowedInGreenAfterPublishing"
When the validation on GitHub is done, it's done and normally it should work.
NOTE: Verification on GitHub can take 2 to 3 hours or even 4 hours. Be patient! (I hope)

Unable to install a kernel even though it compiled successfully

I'm trying to install a linux-Kernel version 4.9.228 in my ubuntu 20.04.
The kernel compiled successfully, without any errors. I also executed the command:
sudo make modules_install install
When I rebooted my system, to check whether it made correct entry, I checked the files under the /boot/ directory:
System.map-4.9.228
vmlinuz-4.9.228
initrd.img-4.9.228
config-4.9.228
I don't know why but when I ran uname -r. It hasn't updated my version. It still says 5.4.0-37-generic.
Please guide me if I am missing something.
Note: The sole purpose of doing all this, is to learn how to add a system call and how to compile a kernel. I'm open to suggestions, if you got any. Thanks.
You might have successfully installed a different kernel version, but in order to boot into it, you need to tell the bootloader to do so.
I'm going to assume that you are using GRUB2 as bootloader, since it's standard on most distributions including Ubuntu. In order to boot the new kernel, you have multiple options.
Option 1
This is the safest and recommended option.
Edit the GRUB configuration file /etc/default/grub (you need to be root, so use something like sudo vi or sudo nano) and make sure that you have GRUB_TIMEOUT=N where N is a number of seconds. If you don't, then just add it in a new line. You want N to be at least 5 or 10 so that you have time to select the correct kernel version when GRUB starts.
Additionally, make sure that you do not have any of the following lines (you shouldn't have them, but if you do, remove or comment them):
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_SUBMENU=y
GRUB_HIDDEN_TIMEOUT=N
GRUB_TIMEOUT_STYLE=hidden
Save the changes to /etc/default/grub and run sudo update-grub. This will detect currently installed kernels and add them to the bootable list when you start the computer and enter GRUB.
Reboot your PC, when GRUB starts you will see a list of options. If you don't do anything, your default kernel will boot, otherwise you can use the arrow keys and the ENTER key to navigate to "Advanced options for Ubuntu", where you will find the list of available kernels and you will be able to select the one you prefer.
It should look something like this:
Option 2
Use only as fallback if option 1 does not work (it should, but you never know). This is not as clean as option 1 because it changes the default kernel, and changes are also probably going to be overridden by an upgrade of your current kernel (which technically does exactly this to update the default version).
Make the kernel you want the default one by changing the two symlinks /initrd.img and /vmilunuz to point to the right versions of the kernel and initrd image. This can be done either manually or through the linux-update-symlinks command.
$ linux-version list --paths
... grab the correct VERSION and PATH ...
$ sudo linux-update-symlinks install VERSION PATH
Run sudo update-grub to let GRUB detect the changes.
Reboot your PC.
Option 3
Manually boot into the kernel you want from the GRUB command line. This is an advanced option and I'm listing it only as a last resort, you should never need to do this unless you have completely broken your system configuration.
Reboot the PC into GRUB, and as soon as you see it, press C to enter the GRUB command line.
Follow this answer from now on.
In any case, remember that playing around with kernel development on your own machine is not a good idea if you are not sure what you are doing. I recommend you use a virtual machine to experiment with the kernel, that way if anything goes wrong you can just throw it away and create a new one.

Flutter stuck on 'flutter' command - no output to console and it doesn't ever finish

I started following this tutorial about Flutter, and I followed each step until the installation of Flutter on windows, even added flutter to PATH.
Now, once I try to execute flutter in CMD / Powershell (I work on Windows 10), it gives no output.
It seems to recognize the command, but it doesn't give further output for a very long time, the console just remains empty.
Has anyone encountered that problem before and knows how to fix it? Thanks.
The problem was that I installed it in C:/Program Files, the guy in the course didn't mention anything about that but in the link you sent they did.
Here's the key takeaway.
Installing flutter in places that requires elevated privileges (e.g. C:\Program Files\ won't work.
Thank you #pskink for the link.
it takes a long time, just wait. or you input flutter --verbose, it will output infomation to console.
Flutter is still in early development (version 1.20 at this point) and things seem to break (occasionally)
I just uninstalled and reinstalled flutter, which got it working again....
On Ubuntu 20.04 I installed flutter using snap. When there is a new release, it downloads almost 500M of files to refresh, and the whole time there is no output (even when I use --verbose flag). I had to use strace to find that a file is being downloaded.
sudo strace -f -t -e trace=file flutter
The output:
[pid 7377] 11:44:20 openat(AT_FDCWD, "latest_stable.tar.xz", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 6
0 515M 0 2206k 0 0 321k 0 0:27:22 0:00:06 0:27:16 375k^Cstrace: Process 7377 detached

Installing CasperJS on Windows: How to do it correctly?

I know there is a documentation from CasperJS website about how to install CasperJS on Windows, but bear with me these guys only explained for the pros only.
If you are new to all this CasperJS and PhantomJS world, you dont stand a chance to understand not even spending two days trying to search the net for a better explanation.
I am working on a project that requires a screenshot of each website listed on my project website, looking around i found out that PhantomJS would be great for this task (website screenshot).
I downloaded PhantomJS and and pasted its phantomjs.exe file in system32 which is working well when i use cmd.exe to send command.
I even managed to grab screenshot with the phantomjs.exe only. but my problem came when i noticed the the workload could be easier when these two work together (CasperJS and PhantomJS) as i can even be able to reduce the size of the screenshot when using CasperJS.
In fact the only use that i want CasperJS for is the limiting of the shot size but since yesterday i have been trying to figure out how to make CasperJS work on Windows but with no avail.
I have downloaded CasperJS and tried to install it in many ways also trying to follow the documentation but nothing.
I changed the CasperJS folder name from its download name to CasperJS as the documantation suggest but when i check in the cmd trying to call some commands, nothing happens.
Anyway to cut the story shot can anyone help me in simple terms considering that i am a newbie to explain how CasperJS can be installed on window or if possible with PhantomJS only how can i re-size the iamge the the program produces lets say if i want a 960 to 400px.
Poor documentation for windows. http://casperjs.org/installation.html#windows
It starts off assuming you have already installed without telling you how to install.
So here it is if anyone else is confused about this. There is no actual install. It's just extracting zip contents to the right place.
download phantomjs for windows from the phantomjs site (it's a zip with binary inside)
extract the contents to C:\phantomjs
download the casperjs zip file from the casperjs website
extract the contents to C:\casperjs
Now you can add the following to the end your system or user PATH variable
;C:\phantomjs;C:\casperjs\batchbin
restart cmd.exe to pick up the new path variable or logout/login if you are running Console2 or Conemu terminal emulator (they won't pick up new paths by a simple close and re-open)
Now in the docs it says to run it like this
casperjs.bat myscript.js
Actually since both phantomjs.exe and casperjs.bat are now in the system PATH you can leave off the extension like this.
casperjs myscript.js
And when running phantomjs.exe just run
phantomjs
One more thing. It really doesn't matter where you install as long as you add that path to the system PATH. I installed to C:\usr\phantomjs and C:\usr\casperjs.
I itemize below the method that has served my needs on both my personal Windows and Ubuntu work PC. DO note that my method doesn't fiddle with PATH settings but involves a command you could save somewhere & copy and paste as needed:
Step 1: Gather the prerequisites
Download the casperjs and phantomjs versions you want to use
Make a directory to contain the things I want to list
Extract the downloaded phantomjs & copy its executable into the directory of step b
Extract casperjs and rename its folder to casperjs
Copy the renamed casperjs folder to the directory of step b
Create and save a file config.json to the directory of step b
config.json should contain phantomjs configurations as found here: http://phantomjs.org/api/command-line.html
Step 2: Running your script
Whenever you want to work with a file, follow the Step 1 details above
The next step assumes that you are in the directory created in step
b of Step 1 also have a file named first.js
On Windows: phantomjs.exe --config=config.json casperjs/bin/bootstrap.js --casper-path=casperjs --cli first.js
On Ubuntu: ./phantomjs --config=config.json casperjs/bin/bootstrap.js --casper-path=casperjs --cli first.js
Experimental config.js and first.js are listed below:
config.json
{"sslProtocol": "any", "cookiesFile": "biscuit", "maxDiskCacheSize": 1000, "diskCache": true}
first.js
var casper = require('casper').create({
pageSettings: {
loadImages: false,
loadPlugins: true,
userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'
}
});
var url = "http://casperjs.org/";
casper.start(url).wait(60 * 1000 * 1, function() {
casper.echo('1 min has passed');
casper.capture('casperjs.png');
casper.exit();
});
casper.run();
Addendum: download and save the details of screenshots.js and run it as
phantomjs.exe --config=config.json casperjs/bin/bootstrap.js --casper-path=casperjs --cli screenshots.js http://phantomjs.org
Run Tests: download & save the details of picturefill-test.js and run it as
phantomjs.exe --config=config.json casperjs/bin/bootstrap.js
--casper-path=casperjs test --cli picturefill-test.js
As of CasperJS 1.1.0-DEV Beta 3 you should use this PATH: C:\casperjs\batchbin even though the documentation found here states you need to use C:\casperjs\bin
The reason to this is because C:\casperjs\batchbin includes a .BAT which C:\casperjs\bin does not include anything except some.js files.
after a 3days work, i managed to get it work the problem was with the path and the installation of phantom. i had made the path to a folder but the installation was pointing to the exe file all i had to do was to put the exe file into a folder phantomjs and that was it thank for your help all.
Many of the other answers are out of date. Since it seems like the correct install process keeps changing all the time, I suspect my answer will be out of date also in a few days, but as of March 19, 2015, this is the answer. The other answers, even highly upvoted ones, do not work, so don't waste your time. Good luck. Casperjs seems quite good.
If you download PhantomJS 2.0 and casperjs 1.1-beta3 zip file and put the batchbin directory in the path and put phantom exe in that same folder, then run casperjs, on Windows 8.1 I get the error "CasperJS needs PhantomJS v1.x".
So, I got the latest casperjs direct from github, which has no batchbin directory, so I put just the C:\casperjs\bin directory in the path instead and this worked (sort of, I mean it seems to work well enough for me - although running casperjs c:\casperjs\tests\selftest.js seems to have a number of failing tests).
So to recap, the bad news is only the very latest bleeding edge casperjs works. The good news is the install is 1,2,3 simple:
Clone latest casperjs from github into c:\casperjs.
Copy phantomjs.exe (ver 2.0) to c:\casperjs\bin
Add c:\casperjs\bin to your windows path
Just in case you're using a notebook with dual graphic cards like I do: choose one of them to prevent issues. This article helped me out:
casperJS not finishing on windows
the casperJS documentation is pretty clear about it but I had no clue what to do until I read the notice above.
Fast forward to 2015... 5-steps win7 howto:
choco: PS me> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
git: choco install git -y
phantomjs 2.0: choco install phantomjs -y
casperjs source: git clone https://github.com/n1k0/casperjs -b phantomjs-2
Add the location of casperjs/bin to PATH
Done. You can now casperjs --version and live happily ever after.
Ok guys. So I think this thread needs refreshing for 2018!
So with npm, the effort is reduced significantly. Given that you have npm installed, open terminal and go to your project:
cd your_project_name
Now install casperjs. Use --save-dev, --save, -g or none as needed:
npm install --save-dev casperjs
Now install phantomjs. To do this, you should install phantomjs-prebuilt, because PhantomJS team changed their package name:
npm install --save-dev phantomjs-prebuilt
Run your spec:
casperjs your_spec_name.js

Starting PalmPre2 Dev. Palm-install says: "no devices found"

I am a iPhone Developer trying to start PalmPre2 development, so I am doing as written here
I have my emulator working and running.
I have created my workspace directory
$mkdir palmWorkspace
$cd palmWorkspace
I have create my app
$ palm-generate -p "{title:'Hello World', id:com.nacho4d.hello, version:'1.0.0'}" HelloWorld
generating new_app in /Users/nacho4d/Documents/palmWorkspace/HelloWorld
I have packaged it
$ palm-package Helloworld
creating package com.nacho4d.hello_1.0.0_all.ipk in /Users/nacho4d/Documents/palmWorkspace
but now when I try to install it I get:
$ palm-install com.nacho4d.hello_1.0.0_all.ipk
palm-install: no devices found
palm-install: no device found
Even though I have the emulator running it says the same, why is that?
Thanks in advance.
Ignacio
Answer to myself:
I have realized that pal-install seems not to be as fast as expected when recognizing/finding a running emulator. I mean, if you start the emulator just before running palm-install command, this will probably fail. After a while running the same command worked as expected ;)

Resources