May
22
Extra Cupcake, Still No Latitude
15 years ago, at the end of May | Leave a Comment
After getting Android Cupcake about a month ago and running it happily, this morning I was notified of another update that was a security fix. I have been unable to find anything that mentions what the fix was for, I guess it’s a little early for that information to be floating around. I’ve got my log from the G1 and will be taking a look to see if there’s anything interesting there.
Shame that this fix didn’t include making Latitude available for UK users – Google seems to be coming up with excuses that don’t really wash for that. Considering Latitude is available to pretty much every other smart phone out there and that it’s even on the G2.
If you want to get a copy of the update, you can download it direct from Google’s servers
Update:
I’ve extracted the update and here’s a list of the contents, the largest patch is in Maps (at 291KB) and the second largest is in framework.odex (at 271KB), then “MediaUploader” which is likely to be the YouTube and Picasa uploading service (at 166KB).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | total 3496 drwxr-xr-x 6 andypowell staff 204B 23 May 11:24 META-INF -rwxr-xr-x 1 andypowell staff 141K 20 May 10:03 applypatch -rwxr-xr-x 1 andypowell staff 1.6M 20 May 10:03 boot.img drwxr-xr-x 4 andypowell staff 136B 23 May 11:25 patch drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 system ./META-INF: total 56 -rwxr-xr-x 1 andypowell staff 1.7K 20 Aug 2008 CERT.RSA -rwxr-xr-x 1 andypowell staff 12K 20 Aug 2008 CERT.SF -rwxr-xr-x 1 andypowell staff 12K 20 Aug 2008 MANIFEST.MF drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 com ./META-INF/com: total 0 drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 google ./META-INF/com/google: total 0 drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 android ./META-INF/com/google/android: total 96 -rwxr-xr-x 1 andypowell staff 47K 20 May 10:03 update-script ./patch: total 0 drwxr-xr-x 9 andypowell staff 306B 23 May 11:25 system ./patch/system: total 8 drwxr-xr-x 93 andypowell staff 3.1K 23 May 11:24 app drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 bin -rwxr-xr-x 1 andypowell staff 236B 20 May 10:03 build.prop.p drwxr-xr-x 6 andypowell staff 204B 23 May 11:26 etc drwxr-xr-x 37 andypowell staff 1.2K 23 May 11:24 framework drwxr-xr-x 5 andypowell staff 170B 23 May 11:25 lib ./patch/system/app: total 1896 -rwxr-xr-x 1 andypowell staff 324B 20 May 10:02 AlarmClock.apk.p -rwxr-xr-x 1 andypowell staff 262B 20 May 10:02 AlarmClock.odex.p -rwxr-xr-x 1 andypowell staff 582B 20 May 10:02 Browser.apk.p -rwxr-xr-x 1 andypowell staff 312B 20 May 10:02 Browser.odex.p -rwxr-xr-x 1 andypowell staff 156B 20 May 10:02 BugReport.apk.p -rwxr-xr-x 1 andypowell staff 266B 20 May 10:02 BugReport.odex.p -rwxr-xr-x 1 andypowell staff 223B 20 May 10:02 Calculator.apk.p -rwxr-xr-x 1 andypowell staff 266B 20 May 10:02 Calculator.odex.p -rwxr-xr-x 1 andypowell staff 402B 20 May 10:02 Calendar.apk.p -rwxr-xr-x 1 andypowell staff 262B 20 May 10:03 Calendar.odex.p -rwxr-xr-x 1 andypowell staff 205B 20 May 10:03 CalendarProvider.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 CalendarProvider.odex.p -rwxr-xr-x 1 andypowell staff 566B 20 May 10:03 Camera.apk.p -rwxr-xr-x 1 andypowell staff 268B 20 May 10:03 Camera.odex.p -rwxr-xr-x 1 andypowell staff 11K 20 May 10:03 Contacts.apk.p -rwxr-xr-x 1 andypowell staff 260B 20 May 10:03 Contacts.odex.p -rwxr-xr-x 1 andypowell staff 174B 20 May 10:03 DownloadProvider.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 DownloadProvider.odex.p -rwxr-xr-x 1 andypowell staff 165B 20 May 10:03 DrmProvider.apk.p -rwxr-xr-x 1 andypowell staff 257B 20 May 10:03 DrmProvider.odex.p -rwxr-xr-x 1 andypowell staff 455B 20 May 10:03 Email.apk.p -rwxr-xr-x 1 andypowell staff 270B 20 May 10:03 Email.odex.p -rwxr-xr-x 1 andypowell staff 1.6K 20 May 10:03 FieldTest.apk.p -rwxr-xr-x 1 andypowell staff 631B 20 May 10:03 Gmail.apk.p -rwxr-xr-x 1 andypowell staff 267B 20 May 10:03 Gmail.odex.p -rwxr-xr-x 1 andypowell staff 176B 20 May 10:03 GmailProvider.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 GmailProvider.odex.p -rwxr-xr-x 1 andypowell staff 191B 20 May 10:03 GoogleApps.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 GoogleApps.odex.p -rwxr-xr-x 1 andypowell staff 170B 20 May 10:03 GoogleContactsProvider.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 GoogleContactsProvider.odex.p -rwxr-xr-x 1 andypowell staff 162B 20 May 10:03 GooglePartnerSetup.apk.p -rwxr-xr-x 1 andypowell staff 261B 20 May 10:03 GooglePartnerSetup.odex.p -rwxr-xr-x 1 andypowell staff 174B 20 May 10:03 GoogleSearch.apk.p -rwxr-xr-x 1 andypowell staff 258B 20 May 10:03 GoogleSearch.odex.p -rwxr-xr-x 1 andypowell staff 172B 20 May 10:03 GoogleSettingsProvider.apk.p -rwxr-xr-x 1 andypowell staff 266B 20 May 10:03 GoogleSettingsProvider.odex.p -rwxr-xr-x 1 andypowell staff 206B 20 May 10:03 GoogleSubscribedFeedsProvider.apk.p -rwxr-xr-x 1 andypowell staff 265B 20 May 10:03 GoogleSubscribedFeedsProvider.odex.p -rwxr-xr-x 1 andypowell staff 154B 20 May 10:03 HTMLViewer.apk.p -rwxr-xr-x 1 andypowell staff 258B 20 May 10:03 HTMLViewer.odex.p -rwxr-xr-x 1 andypowell staff 208B 20 May 10:03 ImProvider.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 ImProvider.odex.p -rwxr-xr-x 1 andypowell staff 443B 20 May 10:03 LatinIME.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 LatinIME.odex.p -rwxr-xr-x 1 andypowell staff 37K 20 May 10:03 Launcher.apk.p -rwxr-xr-x 1 andypowell staff 3.3K 20 May 10:03 Launcher.odex.p -rwxr-xr-x 1 andypowell staff 290K 20 May 10:03 Maps.apk.p -rwxr-xr-x 1 andypowell staff 180B 20 May 10:03 MediaProvider.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 MediaProvider.odex.p -rwxr-xr-x 1 andypowell staff 165K 20 May 10:03 MediaUploader.apk.p -rwxr-xr-x 1 andypowell staff 459B 20 May 10:03 Mms.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 Mms.odex.p -rwxr-xr-x 1 andypowell staff 7.6K 20 May 10:03 Music.apk.p -rwxr-xr-x 1 andypowell staff 265B 20 May 10:03 Music.odex.p -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 NetworkLocation.apk.p -rwxr-xr-x 1 andypowell staff 1.9K 20 May 10:03 NetworkLocation.odex.p -rwxr-xr-x 1 andypowell staff 198B 20 May 10:03 PackageInstaller.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 PackageInstaller.odex.p -rwxr-xr-x 1 andypowell staff 29K 20 May 10:03 Phone.apk.p -rwxr-xr-x 1 andypowell staff 23K 20 May 10:03 Phone.odex.p -rwxr-xr-x 1 andypowell staff 23K 20 May 10:03 Settings.apk.p -rwxr-xr-x 1 andypowell staff 266B 20 May 10:03 Settings.odex.p -rwxr-xr-x 1 andypowell staff 168B 20 May 10:03 SettingsProvider.apk.p -rwxr-xr-x 1 andypowell staff 262B 20 May 10:03 SettingsProvider.odex.p -rwxr-xr-x 1 andypowell staff 18K 20 May 10:03 SetupWizard.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 SetupWizard.odex.p -rwxr-xr-x 1 andypowell staff 215B 20 May 10:03 SoundRecorder.apk.p -rwxr-xr-x 1 andypowell staff 261B 20 May 10:03 SoundRecorder.odex.p -rwxr-xr-x 1 andypowell staff 206B 20 May 10:03 Stk.apk.p -rwxr-xr-x 1 andypowell staff 262B 20 May 10:03 Stk.odex.p -rwxr-xr-x 1 andypowell staff 212B 20 May 10:03 Street.apk.p -rwxr-xr-x 1 andypowell staff 265B 20 May 10:03 Street.odex.p -rwxr-xr-x 1 andypowell staff 195B 20 May 10:03 SystemUpdater.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 SystemUpdater.odex.p -rwxr-xr-x 1 andypowell staff 450B 20 May 10:03 Talk.apk.p -rwxr-xr-x 1 andypowell staff 265B 20 May 10:03 Talk.odex.p -rwxr-xr-x 1 andypowell staff 170B 20 May 10:03 TelephonyProvider.apk.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 TelephonyProvider.odex.p -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 UserDictionaryProvider.apk.p -rwxr-xr-x 1 andypowell staff 252B 20 May 10:03 UserDictionaryProvider.odex.p -rwxr-xr-x 1 andypowell staff 421B 20 May 10:03 Vending.apk.p -rwxr-xr-x 1 andypowell staff 269B 20 May 10:03 Vending.odex.p -rwxr-xr-x 1 andypowell staff 174B 20 May 10:03 Webnwalk.apk.p -rwxr-xr-x 1 andypowell staff 255B 20 May 10:03 Webnwalk.odex.p -rwxr-xr-x 1 andypowell staff 359B 20 May 10:03 YouTube.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 YouTube.odex.p -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 checkin.apk.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 checkin.odex.p -rwxr-xr-x 1 andypowell staff 196B 20 May 10:03 gtalkservice.apk.p -rwxr-xr-x 1 andypowell staff 261B 20 May 10:03 gtalkservice.odex.p ./patch/system/bin: total 8 -rwxr-xr-x 1 andypowell staff 160B 20 May 10:03 debuggerd.p ./patch/system/etc: total 96 -rwxr-xr-x 1 andypowell staff 42K 20 May 10:03 NOTICE.html.gz.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 contributors.html.p drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 security ./patch/system/etc/security: total 8 -rwxr-xr-x@ 1 andypowell staff 175B 20 May 10:03 otacerts.zip.p ./patch/system/framework: total 1040 -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 am.jar.p -rwxr-xr-x 1 andypowell staff 257B 20 May 10:03 am.odex.p -rwxr-xr-x 1 andypowell staff 176B 20 May 10:03 android.awt.jar.p -rwxr-xr-x 1 andypowell staff 270B 20 May 10:03 android.awt.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 android.policy.jar.p -rwxr-xr-x 1 andypowell staff 234B 20 May 10:03 android.policy.odex.p -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 android.test.runner.jar.p -rwxr-xr-x 1 andypowell staff 6.9K 20 May 10:03 android.test.runner.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 com.android.im.plugin.jar.p -rwxr-xr-x 1 andypowell staff 264B 20 May 10:03 com.android.im.plugin.odex.p -rwxr-xr-x 1 andypowell staff 152B 20 May 10:03 com.google.android.gtalkservice.jar.p -rwxr-xr-x 1 andypowell staff 266B 20 May 10:03 com.google.android.gtalkservice.odex.p -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 com.google.android.maps.jar.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 com.google.android.maps.odex.p -rwxr-xr-x 1 andypowell staff 285B 20 May 10:03 core.jar.p -rwxr-xr-x 1 andypowell staff 46K 20 May 10:03 core.odex.p -rwxr-xr-x 1 andypowell staff 155B 20 May 10:03 ext.jar.p -rwxr-xr-x 1 andypowell staff 211B 20 May 10:03 ext.odex.p -rwxr-xr-x 1 andypowell staff 63K 20 May 10:03 framework-res.apk.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 framework-tests.jar.p -rwxr-xr-x 1 andypowell staff 262B 20 May 10:03 framework-tests.odex.p -rwxr-xr-x 1 andypowell staff 168B 20 May 10:03 framework.jar.p -rwxr-xr-x 1 andypowell staff 270K 20 May 10:03 framework.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 ime.jar.p -rwxr-xr-x 1 andypowell staff 252B 20 May 10:03 ime.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 input.jar.p -rwxr-xr-x 1 andypowell staff 249B 20 May 10:03 input.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 monkey.jar.p -rwxr-xr-x 1 andypowell staff 267B 20 May 10:03 monkey.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 pm.jar.p -rwxr-xr-x 1 andypowell staff 263B 20 May 10:03 pm.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 services.jar.p -rwxr-xr-x 1 andypowell staff 4.6K 20 May 10:03 services.odex.p -rwxr-xr-x 1 andypowell staff 153B 20 May 10:03 svc.jar.p -rwxr-xr-x 1 andypowell staff 255B 20 May 10:03 svc.odex.p ./patch/system/lib: total 16 -rwxr-xr-x 1 andypowell staff 4.7K 20 May 10:03 libicudata.so.p drwxr-xr-x 3 andypowell staff 102B 23 May 11:24 modules ./patch/system/lib/modules: total 8 -rwxr-xr-x 1 andypowell staff 618B 20 May 10:03 wlan.ko.p ./system: total 3672 -rwxr-xr-x 1 andypowell staff 1.8M 20 May 10:03 recovery.img |
Tagged with: android • Cupcake • G1 • google • Latitude • security update • software
May 22, 2009 9:12
Apr
25
G1 Assault on battery
15 years ago, at the end of April | Leave a Comment
I know I’m late to the party but a few days ago I received a small package containing a T-Mobile G1 phone running Android. The first thing I did was go to unlock-now to get myself a SIM unlock code. After submitting my details and paying up the 17.50 EUR it was just a case of waiting for the email, about 3 hours in my case. The email details everything you need to know when unlocking, particularly useful is the info on setting up a new APN which you’ll need to do if you aren’t using T-Mobile as your carrier. My O2 PAYG SIM from my iPhone worked fine and soon the G1 was syncing happily with gmail. One of the things that struck me about the G1 was all the negative comment on it’s size and feel that I’d read in various blogs and reviews. Personally I couldn’t see and issue with either the thickness of the device or the the look and feel of it and I wasn’t alone in that. I really don’t see what all the ‘complaints’ were about.
One of the things I had heard though, that I can confirm, is the poor battery life. Without installing any extra software the only real control over the G1’s power management seems limited to turning off the GPS or WiFi. However, there is a ray of light. After installing Power Manager things improved immensely but it still wasn’t enough. The solution I settled on was to buy an extended, 2400mAh, battery which came with a replacement back. The battery is physically 2 or 3 times the thickness of the original, which is why you get a replacement and the end result is a device that’s about as thick as a NOKIA N95.
So why didn’t I wait for a G2? Simple really. The G1 has a wonderful physical keyboard. I really can’t stand on screen keyboards, perhaps I’m a minority.
Of course the other reason that I wont be getting a G2 is that Vodafone are capping both daily and monthly usage when you sign up – 15mb / day and 500mb a month. Perhaps everyone at Vodafone still uses a 6310? Maybe they just don’t like the G2 or Android. Who knows?
Update (Sunday 10th May) : G1 Running cupcake has been running for 3 days with the extended battery and no charging!
Tagged with: android • G1 • Google Phone • opensource
April 25, 2009 22:27
Mar
21
Everywhere you go, always take the weather with you
15 years ago, mid-March | Leave a Comment
Originally I wasn’t going to blog about this but I finally gave in so here it is. This is another one of those things that you really just can’t do with your iPhone unless you’ve jailbroken it.
Having the weather on your lock screen is nothing particularly new, there are enough Winterboard themes that allow you to do this. However, this is slightly different. I’ve never really understood why you’d only ever want to know what the weather was like in your home town. What does it matter? That is of course unless you never actually go anywhere. Why not have the weather for where you are? Yes I know you could just look out of the window or actually go outside but that’s beside the point. What I wanted was to have the weather for where I actually am right now. So, as part of my iPhone tracking system I added the ability for the weather to follow me too. The implementation is rather simple.
Since I’m already sending my location and retrieving the wallpaper image I’m also getting an override (overRide.js) for my weather configureMe.js. The overRide.js contains a single line, the location – as per the configureMe.js format:
var locale="Lelystad,NL" |
So each time the wallpaper is updated, so is this file. One of the key things you need to do to accomplish this for yourself is what is called reverse geocoding. That is, getting the name of your location from your GPS coordinates.
Now, the best way I’ve found of doing this so far is by using geonames this is a fantastic site that allows you to do the reverse geocoding without even blinking. For example, calling geonames using the url
http://ws.geonames.org/findNearbyPlaceName?lat=50.455&lng=-3 |
would result in the following xml being returned
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <geonames> <geoname> <name>Seaton</name> <lat>50.7049382166946</lat> <lng>-3.06999206542969</lng> <geonameId>2638278</geonameId> <countryCode>GB</countryCode> <countryName>United Kingdom</countryName> <fcl>P</fcl> <fcode>PPL</fcode> <distance>28.2265</distance> </geoname> </geonames> </xml> |
This gives you pretty much everything you could possibly want and for free too. Note the inclusion of your distance between your coordinates and the the coordinates returned (nearest named location).
Now I know what you’re thinking. Why would I retrieve a file with the data in it from my server, why not parse the xml in the javascript on the lock screen. You’re right, I could and you, possibly, should. I don’t because I keep all my GPS data in a database on that server so I update the database with the actual locations too. I don’t parse the xml on the iPhone because I don’t need to.
Of course I haven’t yet tested being in some obscure location that the weather provider doesn’t know about. Incidentally, geonames is so freaking good that, if you want to, you can download a daily dump of the database.
Tagged with: GPS • iphone • jailbreak • opensource • software • tracking
March 21, 2009 18:11
Mar
5
Pachube dials without the heartache
15 years ago, at the start of March | 1 Comment
Some people might not want to have their own web server and php installs just to use their Pachube feed to show a dial or two so let me introduce to you the simple way of getting this all to work. Go over to my Pachube app page and follow the on screen instructions. You’ll end up with some text to copy and paste into your web page. All done for you all lovely and simple.
Update Added the ability to de-wiggle the value needle, and then fixed a bug in the wiggle.
Tagged with: opensource • Pachube • software
March 5, 2009 16:51
Mar
4
Dynamic Dials Disclosed
15 years ago, at the start of March | Leave a Comment
There’s been quite a bit of interest in my electricity usage dial like the one below so I’m going to go through how I did it with you. The first thing you’ll need is the XML/SWF Gauge and a web server with PHP. It’s possible to do this on a web server running Perl or ASP but you’ll need to do that yourself. For this example I’m also using a Pachube account to grab the data. My feed, the one for my gauge on the top right, is 1498 but you will want to create your own account and start updating your own data. Using the gauge is as simple as a simple thing.
There are a number of things we need to get this simple display working,
- 1. The .SWF file
- 2. An gauge.html page to show the gauge
- 3. A data fetch PHP script
1. The .SWF file
We’ll come to that at the very end of the article.
2. The gauge.html file.
Open your favourite text editor and cut and paste the following into it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <HTML> <BODY bgcolor="#FFFFFF"> <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="200" HEIGHT="100" id="gauge"> <PARAM NAME="movie" VALUE="/data/gauge.swf?xml_source=/getdata.php" /> <PARAM NAME="quality" VALUE="high" /> <param name="wmode" value="transparent"> <param name="allowScriptAccess" value="sameDomain" /> <EMBED src="/data/gauge.swf?xml_source=/getdata.php" quality="high" wmode="transparent" WIDTH="200" HEIGHT="100" NAME="gauge" allowScriptAccess="sameDomain" swLiveConnect="true" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED> </OBJECT> </BODY> </HTML> |
Save the file as gauge.html.
3. A data fetch PHP script.
Start a new document and cut and paste the following. Before you save the file as getdata.php make sure you change the $myFeedId and $myFeedStream values to match your Pachube feed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <? $myFeedId=1498; $myFeedStream=1; $myURLPath='/getdata.php'; $url = "http://www.pachube.com/feeds/$myFeedId/datastreams/$myFeedStream/history.csv"; $now = gmdate('Y-m-d').'T'.gmdate('H:i:s').'Z'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false ); curl_setopt($ch, CURLOPT_HEADER, 0); ob_start(); $result = curl_exec($ch); $resultStr = ob_get_contents(); ob_end_clean(); curl_close($ch); if ($result) { $readings = split(",",$resultStr); $last=(($readings[count($readings)-1])/40); $prev=-90+(($readings[count($readings)-2])/40); $mval = (max($readings)/40); $tval=-90; header("Content-Type: text/xml\n\n"); ?> <gauge> <update url='<?=$myURLPath;?>?m=<?=$mval?>' delay='909' delay_type='1' timeout='30' retry='9' /> <? RadialTicks( 100, 75, 60, 15, -90, -45, 12, 3, "33ff33" ); RadialTicks( 100, 75, 60, 15, -45, 0, 12, 3, "efe415" ); RadialTicks( 100, 75, 60, 15, 0, 45, 12, 3, "ef8b15" ); RadialTicks( 100, 75, 60, 15, 45, 94, 12, 3, "ff3333" ); ?> <text x='40' y='50' width='220' align='left' size='10' color='000000' alpha='20'><?=$now;?></text> <text x='150' y='100' width='120' align='center' size='24' color='000000' alpha='100'>Watts (W)</text> <rotate x='100' y='75' start='-90' span='<?=$mval?>' step='3' shake_frequency='0' shake_span='3' shadow_alpha='15'> <polygon fill_color='ff0000' fill_alpha='90' line_alpha='0'> <point x='97' y='5' /> <point x='101' y='5' /> <point x='102' y='63' /> <point x='96' y='63' /> </polygon> <rect x='94' y='87' width='10' height='10' fill_color='ff0000' fill_alpha='90' line_alpha='50' /> </rotate> <rotate x='100' y='75' start='<?=$prev?>' span='<?=$last?>' step='1' shake_frequency='95' shake_span='3' shadow_alpha='15'> <polygon fill_color='000000' fill_alpha='90' line_alpha='0'> <point x='100' y='10' /> <point x='101' y='10' /> <point x='101' y='63' /> <point x='96' y='63' /> </polygon> <rect x='94' y='87' width='10' height='20' fill_color='000000' fill_alpha='90' line_alpha='50' /> </rotate> <circle x='100' y='75' radius='14' fill_color='000000' fill_alpha='50' line_alpha='0' /> </gauge><? } function RadialTicks ( $x_center, $y_center, $radius, $length, $start_angle, $end_angle, $ticks_count, $thickness, $color ) { for ( $i = $start_angle; $i <= $end_angle; $i += ($end_angle-$start_angle)/($ticks_count-1) ) { echo " <line x1='".($x_center+sin(deg2rad($i))*$radius). "' y1='".($y_center-cos(deg2rad($i))*$radius)."' x2='" .($x_center+sin(deg2rad($i))*($radius+$length))."' y2='" .($y_center-cos(deg2rad($i))*($radius+$length)) ."' thickness='".$thickness."' color='".$color."' />\n"; } } ?> |
Copy the .swf file that you downloaded from the XML/SWF Gauge site and put it on your web server along with your gauge.html and getdata.php files. Point your browser at your website and the gauge.html page and bask in your glorious meter display.
I should point out that this is using the historic feed data from pachube which has a 15 minute lag. The reason for this is simply because it does not require authentication with the pachube servers. If you want to use your live feed you will need to change the url used and the management of the data returned as well as adding
1 | curl_setopt($curl, CURLOPT_USERPWD, "username:password"); |
just before the ob_start(); on line 16. Replace username:password with your actual username and password, don’t forget the colon in between. When changing the url you might want to use the secure https rather than just http.
Tagged with: opensource • Pachube • software
March 4, 2009 18:08
Current Electricity Use (15min)
iPhone/Webkit RSS Reader
Links
- automated home
- Automated It Technology News
- awooga!!!
- LinITX
- My Acer page
- My Asterisk pages
- My Work in progress (old)
- Noble Race Car
- openmoko / neo 1973 wiki
- planet openmoko
- Spadgecock Cumpants