maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] Queen BeeCon Widget: Super powerful and customizable Widget Generation Engine - Official Thread (https://talk.maemo.org/showthread.php?t=45388)

fpp 2010-02-24 14:56

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
Hi,

I don't think my use cases will fit the "Queeen Beecon" approach, but I must thank you none the less for bringing its ancestor "Desktop Command Execution" to my attention. I don't know how I managed to miss it, but the idea behind both widgets is incredibly useful !

No!No!No!Yes! 2010-02-24 16:41

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
Quote:

Originally Posted by No!No!No!Yes! (Post 543602)

Before using this Beecon make sure you have "wget" package installed:

Start X-Terminal and type:
Code:

Nokia-N900-51-1:/home/user/MyDocs# wget
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
Nokia-N900-51-1:/home/user/MyDocs#

If you don't the above output you need to install the package:
Code:

apt-get install wget

I quote a previous post to clarify some possible issues with respect to the use of wget to retreive webpages to be parsed for relevant contents.

Proxy support in N900 Maemo (don't know for previous versions) is far from being perfect and comfortable to handle.

While testing the previous Beecon behind our company's firewall, hildon-home/desktop got frozen because of the wget command trying to access internet resources while being blocked by our firewall.

Only way to unfreeze it was to kill both the shell script spawned by Beecon, awk and wget hung processes.

UPDATE 201002251730{Don't know why wget hung itself like this in endless timeout but} Setting -t 1 -T 3 options prevents wget from hanging and getting stuck for more then -T 3 seconds even if connection or proxy problems arise!!! However set -T <secs> according to the foreseen size of the web content to be fetched
I figured out a way to programmatically retrieve the proxy settings both for HTTP and for HTTPS from the internal MicroB browser configuration file: /home/user/.mozilla/microb/prefs.js

File holds several values related to proxy settings:
Code:

user_pref("network.proxy.http", "my.proxy.pri");
user_pref("network.proxy.http_port", 3128);
user_pref("network.proxy.no_proxies_on", "");
user_pref("network.proxy.ssl", "my.proxy.pri");
user_pref("network.proxy.ssl_port", 3128);
user_pref("network.proxy.type", 1);

These values are also updated every time a new internet/network connection is estabilished with the configurations present in the internet connection settings.
http://i47.tinypic.com/3582csk.png

In order for wget to properly work behind a proxy, two environment variables must be set in this way:
Code:

export http_proxy=http://my.proxy.pri:3128/
export https_proxy=http://my.proxy.pri:3128/

Following one-liner script, which must be prepended to the wget command, does exactly that. It parses the MicroB/Browser configuration file and generates the statements to dynamically set those two variables:

Code:

`awk 'BEGIN {FS="[\(\", ;\)]+"}/proxy\.http"/{hx=$3}/proxy\.http_port"/{hp=$3}/proxy\.type"/{pt=$3}/proxy\.ssl"/{sx=$3}/proxy\.ssl_port"/{sp=$3}END{if(pt==0)exit;print "export http_proxy=http://" hx ":" hp "\/ export https_proxy=http://" sx ":" sp "\/"}' /home/user/.mozilla/microb/prefs.js`
So the final statement to feed the MLB Beecon with, will be this one:
Code:

`awk 'BEGIN {FS="[\(\", ;\)]+"}/proxy\.http"/{hx=$3}/proxy\.http_port"/{hp=$3}/proxy\.type"/{pt=$3}/proxy\.ssl"/{sx=$3}/proxy\.ssl_port"/{sp=$3}END{if(pt==0)exit;print "export http_proxy=http://" hx ":" hp "\/ export https_proxy=http://" sx ":" sp "\/"}' /home/user/.mozilla/microb/prefs.js`;wget -t 1 -T 3 -O - http://m.mlb.com/scores/`date +%Y%m%d`/ | awk 'BEGIN{t="NYY";m=0}/<td>.+<\/td>/{split(gensub(/<[^>]*>/,"","g"),a);if(a[1]!=t && a[3]!=t && a[4]!=t)next;m=1;if(a[2]=="vs."){print a[1] "\n" a[3] "\n" a[4],a[5];exit 1}print a[1],a[2] "\n" a[4],a[5] "\n" a[6];if((a[4]==t&&a[5]>a[2])||(a[1]==t&&a[2]>a[5]))exit 0;if(a[5]==a[2])exit 1;else exit 2}END{if(m==0){print "No\nMatch!\n";exit 1}}'
Of course you can save the proxy variables builder command into a file system shell script, lets say: pxy.sh and drop it into some PATH-reachable directory ex. /usr/sbin
Code:

# cat /usr/sbin/pxy.sh

awk '
BEGIN {
  FS="[\(\", ;\)]+"
}

/proxy\.http"/ { hx=$3 }
/proxy\.http_port"/ { hp=$3 }
/proxy\.type"/ { pt=$3 }
/proxy\.ssl"/ { sx=$3 }
/proxy\.ssl_port"/ { sp=$3 }

END {
  if ( pt==0 ) exit;
  print "export http_proxy=http://" hx ":" hp "\/ export https_proxy=http://" sx ":" sp "\/"
} ' /home/user/.mozilla/microb/prefs.js

#

Change permissions to executable:
Code:

chmod 755 /usr/sbin/pxy.sh
and, inside the Beecon, use a shorter statement prepended to wget command:
Code:

`pxy.sh` ; wget -t 1 -T 3 -O - http://m.mlb.com/scores/`date +%Y%m%d`/ | awk 'BEGIN{t="NYY";m=0}/<td>.+<\/td>/{split(gensub(/<[^>]*>/,"","g"),a);if(a[1]!=t && a[3]!=t && a[4]!=t)next;m=1;if(a[2]=="vs."){print a[1] "\n" a[3] "\n" a[4],a[5];exit 1}print a[1],a[2] "\n" a[4],a[5] "\n" a[6];if((a[4]==t&&a[5]>a[2])||(a[1]==t&&a[2]>a[5]))exit 0;if(a[5]==a[2])exit 1;else exit 2}END{if(m==0){print "No\nMatch!\n";exit 1}}'

No!No!No!Yes! 2010-02-25 21:48

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
queen-beecon (0.0.3) uploaded to autobuilder a few minutes ago ... should be in devel for download shortly...

* Bugfixing for widget resize(dimensions) and positioning
* Bugfixing for general network related behaviours and content update, even after settings change
* Bugfixing for Command Edit and blank command selector after returning from command edit dialog
* Changed Exit Code output for command from !?0000xxxx to !?xxxx
* Changed Command Output is returned, if any, even if Exit Code less then 0

No!No!No!Yes! 2010-02-26 15:42

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
http://i50.tinypic.com/8yb23a.png
GMail New Messages Notifier Beecon
Following Beecon retrieves number of unread messages in specified Gmail Inbox.
Substitute <username> and <password> with your personal account information.
Code:

wget -t 1 -T 3 -q -O - https://<username>:<password>@mail.google.com/mail/feed/atom --no-check-certificate | awk 'BEGIN{m=2}/<fullcount>.+<\/fullcount>/{gsub(/<[^>]*>/,"",$0);print $1 " New";if($1>0)m=1;else m=0}END{exit m}'
The Beecon statement will return:
Exit Status 0 (Green Beecon) for 0 New Mails
Exit Status 1 (Yellow Beecon) for >0 New Mails
Exit Status 2 (Red Beecon) for problems fetching Mails
Exit Status -1 (Grey Beecon) for System problems

For PROXY/WGET related info have a look at THIS post

Ciao, No!No!No!Yes!

No!No!No!Yes! 2010-03-01 22:43

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
http://i49.tinypic.com/2e2qb9t.png

Stay Tuned...

No!No!No!Yes! 2010-03-02 07:05

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
queen-beecon (0.1.0) now in extras-devel ... same usual relevant advices! :)

* WARNING! Architecture and readibility of code has been heavily revised for implementing the new functionalities...
* WARNING! Please bear with possible regressions and report bugs to the Maintainer
* New: Implemented the possibility to hide the background Canvas both for Beecons and Snippets
* New: Implemented the possibility to use different icons/images for Beecon's status output instead of just specific background color (Ex. 0=green led, 1=yellow led, 2=red led) (with high positioning versatility) ;)
* New: Implemented the possibility to use icons/images instead of text both for Beecons/Snippets command title and output (with high positioning versatility) ;)
* New: Implemented creation and management of private general purpose directory "~/.queen_beecon_dir" for widget (images/icons/etc.)
* New: Implemented "Update on widget Startup" option for every instance
* New: Implemented basic management/deletion of dead/disposed instances configurations data from config file
* New: Added button "Save & Run" settings dialog which saves settings and contextually triggers command execution
* Changed: Widget Layout is now nicer with better gummy "button-press" like visual feedback using Gradient fill
* Changed: Button Save in settings dialog does not trigger a command execution any more
* Changed: Now command do not get updated after getting back from settings dialog (even after "save"); relevant event only drives updates (manual, timer, desktop, network)

No!No!No!Yes! 2010-03-02 20:39

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
1 Attachment(s)
queen-beecon (0.1.1) now in extras-devel ... same usual relevant advices! :)

* Changed: Visual feedback for widget pressure is now also provided for Canvas-less beecons and snippets (button down canvas is displayed when pressed)
* Changed: Changed default size for newly created instances (50px=>100px)
* Changed: Housekeeping for dead/disposed instances is now run on each instance initialization and on class termination (should be more accurate now)
* Bugfixing: Writing/Reading configuration file inconsistencies fixed
* Bugfixing: Correction in images (status/results/title) hide/show logic. If images displayed and then commented out, they kept showing! - FIXED

And some goodies...
http://i50.tinypic.com/15mcmsk.png attached to the post for use as status icon with Beecons.

Bratag 2010-03-02 20:41

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
Quote:

Originally Posted by No!No!No!Yes! (Post 552950)
queen-beecon (0.1.1) now in extras-devel ... same usual relevant advices! :)

* Changed: Visual feedback for widget pressure is now also provided for Canvas-less beecons and snippets (button down canvas is displayed when pressed)
* Changed: Changed default size for newly created instances (50px=>100px)
* Changed: Housekeeping for dead/disposed instances is now run on each instance initialization and on class termination (should be more accurate now)
* Bugfixing: Writing/Reading configuration file inconsistencies fixed
* Bugfixing: Correction in images (status/results/title) hide/show logic. If images displayed and then commented out, they kept showing! - FIXED

And some goodies...
http://i50.tinypic.com/15mcmsk.png attached to the post for use as status icon with Beecons.

So we need to install these independently - not installed by default?

No!No!No!Yes! 2010-03-02 20:59

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
Quote:

Originally Posted by Bratag (Post 552953)
So we need to install these independently - not installed by default?

Ciao...
I'm sorry I still haven't studied how to package icons/images inside .deb and to extract them in relevant directory at .deb install time. If you can point me to some tutorial for doing this, please do... however this issue is in my TODO list but with low priority.
To use this icons you have just to extract them in the ~/.queen_beecon_dir directory and directly refer to them in the settings (if no pathname is specified then QBW looks inside that)
I'm mostly working on solving widget issues and testing core functionalities.
I'd also like to come out with some ways to export/import whole Beecons (basic parameters and possibly icons/images)... to more easily share them once assembled and tested. (I'm also aware of potential security concerns with respect to this matter).

Ciao, No!No!No!Yes!

No!No!No!Yes! 2010-03-02 21:50

Re: [Announce] Queen BeeCon Widget: Customizable and flexible monitoring tool.
 
Queen Beecon Widget 0.1.1 has now been promoted to extra testing.


All times are GMT. The time now is 16:01.

vBulletin® Version 3.8.8