Weather in Speed dial
Wednesday, August 18, 2010 8:41:22 PM
The post below is related to old version of my speed dial weather and still might be useful to someone who uses old versions of Opera. For Opera 11.50+ there is a new Opera extension:
https://addons.opera.com/en/addons/extensions/details/weather-by-wundergound/
______________________________________________________________________
Were you thinking about some alternative way how to use speed dial? Here is one way how you can do that. I've created site with big weather images and description.
So how it works? Very simple.
First part is the URL of the site:
http://speeddial.operacesky.net/weather.php
Put this URL into some speed dial window
Second part is query string. There are five (all optional) parameters that you can use.
1 - Language: lang=en or cs/fr - default is "cs" (Czech language)
2 - Area: area=London - default is Prague (Capital of Czech Republic)
3 - Top: top=100 - this parameter sets margin-top css property of images and description, thank to this parameter you can align the main parts to center of your speeddial window.
4 - Redirect: redirect=http://www.wunderground.com/ - Site to which you get redirected when you click on speed dial window. Default is http://www.wunderground.com/. You can also type: no - this means that you won't be redirected anywhere. If you want to use site with query string you will have to encode this URL, or use some site like http://bit.ly/ (that's what I do).
[NEW] 5 - Degrees: deg=F - Use Fahrenheit instead of Celsius
Thanks for Frenzie who gave me the idea of speed dial vs. real window detection.
So here is one completed example:
http://speeddial.operacesky.net/weather.php?lang=en&area=Oslo&top=100&redirect=http://is.gd/eoCvi
And here is screen of the result:

I hope you like it =)
BTW you should set time interval to reload this speed dial window (I use 30 minutes)















1 2 3 Next »
z@h3kZAHEK # Wednesday, August 18, 2010 8:53:12 PM
FransFrenzie # Wednesday, August 18, 2010 10:36:38 PM
At any rate, I'll be posting some improvement suggestions in a few minutes.
BS-Harou # Wednesday, August 18, 2010 10:39:47 PM
I'm ready for your suggestions =)
lucideer # Wednesday, August 18, 2010 11:34:31 PM
Originally posted by BS-Harou:
Unite "speed-dial" app - it could start out with just weather, and then add other pages serving useful info to the speed-dial thumbs.... I'm not sure what exactly though... just an idea.
dapxin # Wednesday, August 18, 2010 11:36:13 PM
QuHno # Thursday, August 19, 2010 6:04:18 AM
Originally posted by BS-Harou:
What's the syntax for the request to Google to receive the XML file? Is it open or do you have to subscribe somewhere?
FransFrenzie # Thursday, August 19, 2010 8:27:39 AM
BS-Harou pointed out that vertical-align wasn't chosen in case of smaller speed dials, upon which I suggested to use vertical-align unless a top offset were specifically specified, and that the horizontal part of the speed dial doesn't seem to be affected by such so that no left offset is required.
If someone can think of a better way to detect whether something's a speed dial than what I came up with after seeing this idea, I'd be glad to hear it.
Also, QuHNo, I don't know about Google, but Weather Underground offers RSS from which one could easily extract such information. That's one of the reasons I'd like the source, since I'd prefer to host it myself as well as avoid Google (of course it shouldn't be too hard to replicate, but heck, an original idea is an original idea!).
BS-Harou # Thursday, August 19, 2010 9:27:54 AM
Originally posted by QuHno:
Everything is here: http://www.google.com/ig/api?weather=YOUR_CITY
BTW I do plan do give you the source after week or two)
BS-Harou # Thursday, August 19, 2010 9:41:34 AM
metude # Thursday, August 19, 2010 10:02:34 AM
BS-Harou # Thursday, August 19, 2010 10:30:23 AM
Originally posted by metude:
http://speeddial.operacesky.net/weather.php?lang=en&area=Ankara
this works, can you give me name of the city you want?
EDIT: you mean probably alnguage. No it's not (yet). There is only en, cs and fr, but if you want I can send you list of things for translation =)
BS-Harou # Thursday, August 19, 2010 11:43:29 AM
docThe-Doc # Thursday, August 19, 2010 11:59:30 AM
QuHno # Thursday, August 19, 2010 12:26:44 PM
Originally posted by BS-Harou:
Ah! Via the iGoogle API and the response from Google is valid, too. I didn't think about that. Thank You.edit:
I believe most of the Opera users have set their native language as first in thr language settings so you could use this for an automatic UI language detection for the hl= part of the query string:
if ( isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) ){ $languages = strtolower( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ); $pos = strpos(';',$languages); if ($pos !== false){ $languages = substr( $languages, 0, pos-1 ); } $pos = strpos(',',$languages); if ($pos !== false){ $languages = substr( $languages, 0, pos-1 ); } }The double strpos is needed because of the °C,km/h | °F,mph (SI|US) switch.You get °C when using British English or any other language:
http://www.google.com/ig/api?weather=Oslo&hl=en-gb
in comparison to the assumed US setting with °F and mph when using plain English:
http://www.google.com/ig/api?weather=Oslo&hl=en
If the set language is not supported by Google, it defaults to US English, so no harm done:
http://www.google.com/ig/api?weather=Oslo&hl=XX
Most of the world (except USA) use SI instead of US values so may be you should prefer en-gb to get the SI units if the first "Accept Language" is en like it is in my string: en,de;q=0.9,de-DE;q=0.8 ...
@metude: Would work with tr too, see here
Aleksander AasAleksander # Friday, August 20, 2010 11:30:01 AM
BS-Harou # Friday, August 20, 2010 11:50:39 AM
However I'm working now on one new userJS so I'll update this after I finish at least "pre-alpha" of this new userJS =)
Originally posted by QuHno:
the problem is that I need word "Weather" and sentence "We don't have information for this city"
Sami Serolaserola # Friday, August 20, 2010 12:18:27 PM
Abhinavdecodedthought # Friday, August 20, 2010 2:05:34 PM
QuHno # Friday, August 20, 2010 2:48:38 PM
Originally posted by BS-Harou:
Why not just check for the existence of the Element. Primitive but quite complete snippet (without language detection or GET request check):<?php function getWeather() { $requestAddress = "http://www.google.com/ig/api?weather=Oslo&hl=fi"; // Downloads weather data based on location - where is Oslo? :D $xml_str = file_get_contents($requestAddress,0); // Parses XML $xml = new SimplexmlElement($xml_str); // Loops XML $count = 0; echo '<div id="weather">'; if ($xml->problem_cause && ($xml->problem_cause['data'] != '')){ echo '<div>Damn! No Weather!</div>'; } else { foreach($xml->weather as $item) { foreach($item->forecast_conditions as $new) { echo '<div class="weatherIcon">'; echo '<img src="http://www.google.com/' .$new->icon['data'] . '"/><br />'; echo $new->day_of_week['data']; echo '</div>'; } } } echo '</div>'; } getWeather(); ?>metude # Friday, August 20, 2010 2:52:52 PM
Originally posted by BS-Harou:
I was mean language support.
Monday > Pazartesi
Tuesday > Salı
Wednesday > Çarşamba
Thursday> Perşembe
Friday > Cuma
Saturday > Cumartesi
Sunday > Pazar
Sorry i have limited time for now, i didn't read other comments.
BS-Harou # Friday, August 20, 2010 2:56:25 PM
I need those two:
- "Weather"
- "We don't have any information for this city"
PengePenge4 # Friday, August 20, 2010 4:14:06 PM
Originally posted by BS-Harou:
Hungarian translation:
Weather = Időjárás
We don't have any information for this city = Nincs semmilyen információnk erről a városról
Furthermore:
Monday > Hétfő
Tuesday > Kedd
Wednesday > Szerda
Thursday> Csütörtök
Friday > Péntek
Saturday > Szombat
Sunday > Vasárnap
----------------
In the city names, that contains accent, works with the encoded format.
Just enter the name to the Google Search and copy the encoded format.
For example: Győr = Gy%C5%91r
BS-Harou # Friday, August 20, 2010 4:18:32 PM
Thank you.
I want tonight add support for all languages that google supports, but there is translation only for days, so if anyone else want the "weather" word in his language he has to send me the translation.
Dacotah # Friday, August 20, 2010 4:25:05 PM
QuHno # Friday, August 20, 2010 5:36:46 PM
Dutch, nl: Weer - Informatie is tijdelijk niet beschikbaar.
Sn3ipen # Friday, August 20, 2010 5:44:13 PM
Im not sure if you should use no, nb or nn.
Just add them all to be safe, because the word for weather is the same in both Norwegian main languages(nb and nn).
Adonis @ my.opera /friendspartyworld Adonisali # Friday, August 20, 2010 5:46:13 PM
BS-Harou # Friday, August 20, 2010 5:46:40 PM
WildEnte # Friday, August 20, 2010 6:09:31 PM
Mitthaodp # Friday, August 20, 2010 6:18:37 PM
- Thời tiết
- Chúng tôi không có thông tin về thành phố này.
BS-Harou # Friday, August 20, 2010 7:21:27 PM
Originally posted by thaodp:
what is the abbreviation for Vietnamese? "vi"?
Sn3ipen # Friday, August 20, 2010 7:49:13 PM
What about making a Unite app out of this so people can host their own script?
Or using the same kind of technique to show a custom speed dial image. I believe someone could make a Unite App of that?
QuHno # Friday, August 20, 2010 7:58:04 PM
Originally posted by BS-Harou:
Nope, "vn"
see Wikipedia
BS-Harou # Friday, August 20, 2010 8:02:36 PM
Originally posted by QuHno:
but google show english translation for "vn" but probably Vietnamese translation for "vi"
EDIT: ok it's probably not Vietnamese, but it doesn't look like "Virgin Islands" too
FransFrenzie # Friday, August 20, 2010 8:24:54 PM
Originally posted by QuHno:
The language codes and Internet domains are unrelated. You need the ISO 639-1 standard for this kind of thing.
Also see this nice list.
random414 # Friday, August 20, 2010 8:27:02 PM
QuHno # Friday, August 20, 2010 8:31:56 PM
See also here
BS-Harou # Friday, August 20, 2010 8:32:07 PM
Originally posted by Frenzie:
thanks
btw I've got problem with Russian: http://speeddial.operacesky.net/weather.php?lang=ru&top=100&area=Praha&redirect=no
it shows wrong characters, but I can't figure out hy. Everywhere is UTF-8, I tried dozens of conversions but still without success. Any ideas?
FransFrenzie # Friday, August 20, 2010 8:39:25 PM
Originally posted by BS-Harou:
Do the PHP files have the BOM? That could cause problems. See for example here. If you save it as UTF-8 cookie (no BOM, but still UTF-8), it could potentially solve issues created by this PHP bug.
If that's not it, no idea. You're getting the names of the days from Google?
BS-Harou # Friday, August 20, 2010 8:48:23 PM
Originally posted by Frenzie:
Yes, from Google. And it doesn't look like there is the BOM bug (at least as far as I was able to understand it).
FransFrenzie # Friday, August 20, 2010 8:56:07 PM
In the end it comes down to the good old proverb that without seeing some code, it's like trying to operate on a patient in a dark.
BS-Harou # Friday, August 20, 2010 9:00:08 PM
Originally posted by Frenzie:
ok, you've got the code in PM
lucideer # Friday, August 20, 2010 9:28:36 PM
Originally posted by Sn3ipen:
I've done up a quick and dirty one - if anyone wants to take it further and add features, help yourselves.
http://files.myopera.com/lucideer/files/Speeddial.ua
I haven't added a redirect to it (yet) like BS-Harou's version, and you can't customise the top-margin either - as I said, it's just a quick proof-of-concept. I have however set it up with the possibility of adding more (non-weather) speed-dials, if anyone has any suggestions.
BS-Harou # Friday, August 20, 2010 9:31:43 PM
Originally posted by lucideer:
very nice =)
lucideer # Friday, August 20, 2010 10:06:26 PM
Originally posted by BS-Harou:
Aha - approval, great stuff.
I've a question - I was trying to figure out the Goog api. Do you know if there's any way to set Celcius/Fahrenheit explicitly or is it always set by language code (and annoyingly defaults to F for en
BS-Harou # Friday, August 20, 2010 10:08:39 PM
Originally posted by lucideer:
tom tkr1 # Saturday, August 21, 2010 2:10:34 AM
en - Celsius
us - Fahrenheit
metude # Saturday, August 21, 2010 5:38:50 AM
Originally posted by BS-Harou:
Weather = Hava Durumu (But if this too long, you can use just "Hava")
- Bu şehir için bilgi yok. (
Originally posted by BS-Harou:
Did you tried this. Open page Notepad++, Encoding > Convert to UTF8.Someone faster than me.Tip: Set Automatic reload time with 1440 minutes. Your weather info will update every. (I'm not sure "page default" option working.)
d4rkn1ght # Saturday, August 21, 2010 6:14:38 AM
BS-Harou # Saturday, August 21, 2010 7:32:42 AM
Originally posted by metude:
It was much more complicated than that, but it's fixed now =)
I'll add Turkish later (but still today) =) - but you should have already at least days in Turkish.