I am a newbie for this DCEW, just playing with it since few days, reading its wiki pages and this forum regularly. I got lost as for me for certain reasons, scripts i could found on wiki or even the built in ones not working or better to say, several of them not working.
E.g. I would like to create a battery indicator as follows :
Battery : 45% (445mAh / 1200mAh) - Charging
"- Charging" part ONLY if charging
This should be simple as this script should do the main part (except the "- Charging") :
Problem is, that it does not show the full capacity (1200mAh) for some reason.
I had found an other script where they used something like "grep" and that one could read out the 1200mAh, but I could not combine the 2 as I did not understood the structure how it works as lack of experience.
The other thing is, I tried to create a command retrieves the actual IP address which the device reachable from :
Problem is, while my device connected to my home router, lcoal ip shown, but when the device conencted to my Mobile Internet , no ip shows at all, and none of the cases shows any country or such. However, if I load e.g. ipchicken.com, logically, I can see my public ip even through the firewall.
Could someone help me to go through these 2 examples to make it udnerstandable how tehy work, so i can learn it and create other scripts pelase ?
I know I am sking a lot, btu hoping someone could spare a bit of time,
First of all, everything built-in and in wiki is TESTED and it WORKS. So that means that problems are on your side.
First script that you ask for is the one you pasted and is the same as in wiki. It does EXACTLY what you want. It shows percentage, current mAh, last full mAh (after a reboot last full mAh becomes 0 because the phone forgets the value, but everything else works) and when the phone is charging, it displays "Charging".
The other one you found (using grep) reads design mAh, which is always the same. Last full mAh used in the script using awk is better, because you can also monitor battery wear level with it, but it displays 0 value between a reboot and next charging.
About the IP script: The script you found displays wlan0 LAN ip and WAN IP as seen from the internet. The gprs0's IP which you can get with ifconfig is often from private address range, because mobile operators like to use NAT, so this method is not reliable and therefore not used.
Go to myiptest.com from N900's browser while connected to GPRS and post the results here. Maybe myiptest.com doesn't recognize your IP yet.
No, you said, you'd recommend this way. Everybody can use the IP of the server where the site is hosted, but not for everyone this makes sense.
Actually, the question is not trivial.
To start with, we are in agreement, but you seem to misunderstand the following:
If you can, I would recommend using the IP...
There is an implication by stating "If you can" that what follows will not be suitable for all cases. Of course it is true that for all cases an IP can be used to just test the server and it goes without saying that it can be done.
What cannot be done by using the IP is as you stated, when using name based virtual hosting - which is why I refer to the status response as being important, since my script will give a different error response for the following conditions:
1. server cannot be resolved, server is down or server is up, but nothing from the appropriate port.
2. conditions which may indicate a running server but no website. maybe your account has been blocked returning a file not found.
I am with Bluehost and there 2 things I will note here, 1, I will need to modify the script further to get the result because they will block your account by simply placing a different .htaccess file in your folder if there is a potential cross site script problem with any php they know of as a security risk. updating the php code will have the site unblocked.
2. It costs an extra dollar a month to have your own IP. I can operate personal services on incoming ports.
This script will pause the entire desktop whilst running, so avoiding a name lookup is quite appropriate, an alternative solution is add your host to the /etc/resolv.conf and this will allow name based hosts to be checked more quickly.
I tried to make my solution as generic as possible, so only people who know about virtual hosts would know what they need to use. Those who don't know may or may not care that its just the physical server that is being checked and therefore may prefer the speed of an IP check
For those who know what they are looking for, they can of course modify this or write their own.
I thought your original comment was useful, to help clarify.
actually i have to use the dns names because i have internal ip's when im at work on the wlan and external ip's when im outside work. however i am ALWAYS working.
actually i have to use the dns names because i have internal ip's when im at work on the wlan and external ip's when im outside work. however i am ALWAYS working.
That make sense. At my work, our public servers are offsite so our office has no public facing presence nor a public domain.