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

Cupcake CRB43



»crosslinked«

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tagged with:
May 22, 2009 9:12

Mar

21

Originally I wasn’t going to blog about this but I finally gave in so here it is. This isTracking weather 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.

Lock screen weatherLock screen weather, later that day



[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tagged with:
March 21, 2009 18:11

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 usage dialASP 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

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.



[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tagged with:
March 4, 2009 18:08

Mar

1

Gratifying Graphic Gizmos

15 years ago, at the start of March | 2 Comments

Yesterday the Current Cost unit actually got installed for real, something I was dreading. Dreading not because it was a difficult thing to do but simply because I expected the figure it would show would be terrible. Guess what, it wasn’t. In fact it seemed to be fairly close to that of other people who are monitoring theirs. The initial figure of 371 Watts didn’t last too long once the dishwasher and oven came on and an interesting spike appeared when the hob went on for the kettle.



Continuing with my sudden graphing fetish, as well as using a Current Cost unit I have dotted a number of little devices I’ve built with Xbee and Arduinos to measure temperatures (and other things) around the house. More information on those will come out later, but it’s an interesting project too.

Since I have the data for those it’d be rude not to graph them too, there’s a sample in the thumbnails below.

Not content with graphing them locally I picked up a Pachube invite and started graphing data there too. The process is simple really and as you can see on the right hand side of this page under ‘Graphy Stuff’, graph images can be embedded in your own or other sites. The really interesting thing about Pachube is that you can share your data with people who may be interested. The data they get to see is delayed by approximately 15 minutes. If you output your data in the eeml format then you can specify your own tags too.

Electricity Usage GraphTemperature in the garage



[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tagged with:
March 1, 2009 8:47

Feb

13

Current Cost Capers

15 years ago, mid-February | 4 Comments

My Unbioctium Current Cost CC128 arrived on Thursday and although I’m not going to actually get a chance in install it for a couple of weeks I did have a play. The first thing to do once it was all up and paired with the base was get the output into my laptop. To do this you will need to buy the data cable or make up your own…

At first I tried to be smart with reading from the serial port, as that seems to be a bit unreliable I fell back on the old tried and tested method. I also decided from the outset that I was going to parse the XML that the the CC128 spat out rather than just filter the bits needed with regexp.

You will need to make sure you have the perl modules Device::SerialPort and XML::Simple installed. If you don’t have them then as root on your linux box do the following:

perl -MCPAN -e shell

then install each module, for example Device::SerialPort,

install Device::SerialPort

and here’s the script which is also available for download.Updated to make it more reliable.

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
#!/usr/bin/perl
 
use Device::SerialPort qw( :PARAM :STAT 0.07 );
use XML::Simple;
 
$port = "/dev/ttyUSB0";
 
$ob = Device::SerialPort->new($port) or die "Can not open port $port\n";
$ob->baudrate(57600);
$ob->write_settings;
$ob->close;
 
# using XML::Parser speeds xml parsing up lots!
$backend = 'XML::Parser';
$ENV{XML_SIMPLE_PREFERRED_PARSER} = $backend;
 
# we use this to only do 1 iteration (or not)
$escape=0; 
 
open(SERIAL, "<$port");
 
while($escape <= 0) {
	sleep(2);
 
	while ($line = <SERIAL>) {
 
		# for debug
		#print $line;
 
		$isValid = (index($line,"<msg>") != -1);
 
 
		if (!$isValid) { last; }
 
		print "This data is".($isValid==1?"":" not")." valid\n";
 
		# force XML::Simple to see this as a string not as a file
		# since XML::Simple is stupid and needs to be shot
 
		$line = "<fakeTag>$line</fakeTag>";
 
		$isHistoric = (index($line,"<hist>") != -1);
 
		$nref = XMLin($line,forcearray => 0);
 
		$ref = $nref->{msg};
 
		# just for reference, show if data is historic or not
 
		print "This data is".($isHistoric==1?"":" not")." historic\n";
 
 
		if (!$isHistoric) {
 
	        	$dsb        = 0 + $ref->{dsb};
        		$recordTime = $ref->{time};
        		$ccname     = $ref->{src};
        		$temp       = $ref->{tmpr};
			$ch1watts   = 0 + $ref->{ch1}->{watts};
			$sensor     = 0 + $ref->{sensor};
			$id         = $ref->{id};
			$type       = 0 + $ref->{type};
 
 
			if (defined $ref->{whatever}) {
				# do something based on whatever
 
			}
 
        		print "This $ccname was born $dsb days ago as at $recordTime - temperature is: $temp :: Current Watts in use on channel 1 are $ch1watts :: Sensor is $sensor, with an id of $id and a type of $type\n";
 
			# for cacti you'd probably just want to output CC_Temperature:$temp CC_Watts1:$ch1watts 
 
			# insert data into db
 
			# if you want to exit after a 'good' iteration set this to 1 otherwise set it to 0 (or don't change it to 1 :) );
			$escape=1;
		} else {
			#process or ignore historic data
		}
	}
}
 
close(SERIAL);

and here’s some example output, remember that I haven’t actually connected the loop around my electrical cable as yet.

This data is not historic
This CC128-v0.11 was born 1 days ago as at 21:16:44 - temperature is: 23.7 :: Watts used on channel 1 are 0 :: Sensor is 0, with an id of 02835 and a type of 1

Historic data isn’t processed at the moment but it would be trivial to do. I’m not processing it since I don’t really see the point if you’re going to store the results in a database.



[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tagged with:
February 13, 2009 9:38

« go backkeep looking »

Current Electricity Use (15min)


iPhone/Webkit RSS Reader

Links


Tags

1-Wire android api Apple arduino currentcost DDAR development DVD FIC freerunner G1 google Google Phone gphone gprs GPS hardware image image builds inspiration iphone jailbreak kiosk linux Mac monitoring Music neo 1973 Nokia openmoko opensource OSX Pachube personal qtopia rhubarb rikki Rio slimp3 slimserver software tracking Trolltech u-boot


Twitpic


Graphy Stuff






Nasty Spam Monkeys