Notices


Reply
Thread Tools
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#1
I want to make a QBW that will show the no of days remaining to a particular day. Can somebody please show me how we can make a bash/python script that will output, say for example "56 days remaining"?

Kindof like this config for rainmeter:http://jrweinman.deviantart.com/art/...Days-199156665
__________________
My Device History:Nokia 3510 > SE T230 > Nokia 6600 > HP2210 > SE p910i > SE p990i > N95 > I-mate 9502 > itouch > Nokia N900 > ? N9
My apps for N900:
Conversation Modder

My apps for N9:
LockScreenQuotes
USbS


If you feel I have helped you, don't forget to press Thanks!

Last edited by ejasmudar; 2011-09-05 at 08:23.
 
BluesLee's Avatar
Posts: 411 | Thanked: 1,105 times | Joined on Jan 2010 @ Europe
#2
Originally Posted by ejasmudar View Post
I want to make a QBW that will show the no of days remaining to a particular day. Can somebody please show me how we can make a bash/python script that will output, say for example "56 days remaining"?
Something like that?

Code:
echo "$(( ($(date -d "110923" +%s) - $(date +%s)) / 86400 )) days remaining"
p.s. 1. 110923=particular day X=23rd September of 2011 in my case
2. "date +%s" gives you the seconds since unix epoch, i.e. since 1970-01-01 00:00:00 UTC
3. 86400 secs a day = 60 secs * 60 min * 24 hours

Last edited by BluesLee; 2011-09-04 at 09:52.
 

The Following User Says Thank You to BluesLee For This Useful Post:
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#3
can u explain what those constants (110923, 86400) are ?
__________________
My Device History:Nokia 3510 > SE T230 > Nokia 6600 > HP2210 > SE p910i > SE p990i > N95 > I-mate 9502 > itouch > Nokia N900 > ? N9
My apps for N900:
Conversation Modder

My apps for N9:
LockScreenQuotes
USbS


If you feel I have helped you, don't forget to press Thanks!
 
Posts: 142 | Thanked: 120 times | Joined on Jul 2010
#4
like he says:
110923 = 23rd September 2011
86400 secs a day = 60 secs * 60 min * 24 hours
 

The Following User Says Thank You to phap For This Useful Post:
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#5
Originally Posted by phap View Post
like he says:
110923 = 23rd September 2011
86400 secs a day = 60 secs * 60 min * 24 hours
oh thanks that makes sense.

But is the date format dependent on the region/date-format settings? ie, my date is shown as 23/09/2011 so will it be 230911 or is it independant of those settings?
__________________
My Device History:Nokia 3510 > SE T230 > Nokia 6600 > HP2210 > SE p910i > SE p990i > N95 > I-mate 9502 > itouch > Nokia N900 > ? N9
My apps for N900:
Conversation Modder

My apps for N9:
LockScreenQuotes
USbS


If you feel I have helped you, don't forget to press Thanks!
 
Posts: 37 | Thanked: 11 times | Joined on Feb 2010
#6
It'd be cool to have a desktop widget for this.
 
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#7
Thanks to the brilliant QBW, i made a widget on my desktop with the above scripts.
Thanks blueslee and phap!

TMO rocks!
Attached Images
 
__________________
My Device History:Nokia 3510 > SE T230 > Nokia 6600 > HP2210 > SE p910i > SE p990i > N95 > I-mate 9502 > itouch > Nokia N900 > ? N9
My apps for N900:
Conversation Modder

My apps for N9:
LockScreenQuotes
USbS


If you feel I have helped you, don't forget to press Thanks!
 
Posts: 22 | Thanked: 6 times | Joined on Sep 2010
#8
Nice, this looks really good, perhaps an step by step walkthough on how to create one of these babies for us mortals would be fitting.
 
Posts: 37 | Thanked: 11 times | Joined on Feb 2010
#9
Well done! I'd also love a step by step walkthrough . Thanks!
 
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#10
@peterch405, vkthor

Do you guys have Queen Beecon Widget installed? If not, pls install it.

Now, in the desktop screen, click on add new widget, and add a queen beecon widget (aka QBW)

Now, click on the widget edit button (the spanner icon thingy) of the QBW. A settings window will popup.

Here are the MAIN thing to do in that window:
1. Click on "add Cmd"
2. Give the new command a name (something like Days Remaining)
3. Copy the above command by BluesLee and paste it in the Command Box.
4. Change "Type" from Beecon to Snippet
5. Towards the bottom of the window, there is a section "Update Policies & GPS/Location". Change the @Interval to 1 day.

The rest of the settings are mainly cosmetic and can be changed as you wish to get the look you want. Dont be afraid to experiment.
__________________
My Device History:Nokia 3510 > SE T230 > Nokia 6600 > HP2210 > SE p910i > SE p990i > N95 > I-mate 9502 > itouch > Nokia N900 > ? N9
My apps for N900:
Conversation Modder

My apps for N9:
LockScreenQuotes
USbS


If you feel I have helped you, don't forget to press Thanks!
 

The Following User Says Thank You to ejasmudar For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 07:12.