**** BEGIN LOGGING AT Sat Mar 28 02:59:57 2009 Mar 28 03:34:35 does anyone here have apps that crunch a lot of numbers from a database? Mar 28 03:34:44 hmm, sqlite? Mar 28 03:35:08 jsharkey, no, it's not that Mar 28 03:35:31 I have to do a lot of calculations based on data stored and I'm having performance problems Mar 28 03:35:48 so, is the database on android, or a server? Mar 28 03:35:57 oh, sorry. on the phone Mar 28 03:36:18 it's mainly that I have an ORM layer and I have to allocate loads of objects Mar 28 03:36:22 right, so if its coming from a database, its sqlite Mar 28 03:36:24 ORM? Mar 28 03:36:31 object-relational mapping Mar 28 03:36:48 you cant recycle the objects? Mar 28 03:37:10 well, I do stuff like trend data and min/max and averages, so, no, it all has to be loaded Mar 28 03:37:15 look at reference queues Mar 28 03:37:37 select min(value), etc doestn work? Mar 28 03:38:00 jsharkey, it's a bit more involved than that :) Mar 28 03:38:13 min/max of calculated fields based on previous entries and such Mar 28 03:38:28 you could always roll your own storage mechanism? Mar 28 03:38:32 do multiple threads call View.onKeyDown() ? Mar 28 03:38:39 reference queues! :x Mar 28 03:38:44 zinx, I'm googling it! Mar 28 03:38:53 zinx: you mean factories? Mar 28 03:39:09 *factories that keep a recycling queue Mar 28 03:39:36 pjz: they shouldnt unless you're the one calling onKeyDown(). all those events should be dispatched only by UI thread Mar 28 03:39:54 jsharkey: okay, thanks. Mar 28 03:40:12 zinx, I don't see how this would help me Mar 28 03:40:23 (from my 30-second browse through the javadocs) Mar 28 03:40:54 doing the calculations themselves takes no time; it's loading all the data from the DB and putting it into my ORM is what takes too long Mar 28 03:41:18 KNY: you using floats? Mar 28 03:41:40 jsharkey, yes Mar 28 03:41:48 this is why com.google.android.maps.GeoPoint uses microdegrees ;) Mar 28 03:41:52 doing it all with integer math would be insane :) Mar 28 03:42:26 iirc floating point math isnt directly hardware supported on dream Mar 28 03:42:40 dont quote me on that tho Mar 28 03:42:44 jsharkey, I know, that's mentioned in the docs Mar 28 03:43:02 but like I mentioned, it's not the math that's a problem Mar 28 03:43:04 that's pretty fast Mar 28 03:43:22 jsharkey, http://developer.android.com/guide/practices/design/performance.html#avoidfloat Mar 28 03:43:54 KNY: you can use it to re-use objects that have already been allocated, but are no longer referenced Mar 28 03:44:26 zinx, but the problem is that I need all the objects at once Mar 28 03:44:40 lol Mar 28 03:44:45 though I should look in to what the GC is actually cleaning up Mar 28 03:44:51 KNY: well, then you're screwed Mar 28 03:44:53 rewrite the algorithm :) Mar 28 03:45:00 jsharkey, :) Mar 28 03:45:17 have the algo do its traversal using the actual cursor? Mar 28 03:45:24 idk what algo your implementing tho Mar 28 03:45:45 jsharkey, it's for Mileage, my fuel economy tracker Mar 28 03:46:11 when I calculate statistics on fill-ups, it needs to look at the entire history for most of the statistics Mar 28 03:46:14 KNY: you're probably storing the wrong data Mar 28 03:46:18 is there a convenient set of source jars I can get for the 1.1. SDK 1 to point Eclipse at? Mar 28 03:46:32 zinx, how so? Mar 28 03:46:36 KNY: you definitely are if it actually has to have all that available to Java Mar 28 03:47:04 KNY: you should probably be storing difference between the odometer rather than the odometer, or in addition to. makes calculations a lot easier :P Mar 28 03:47:27 KNY: basically, do any calculations that are needing multiple rows up-front Mar 28 03:47:28 KNY: just store a cache!? Mar 28 03:47:40 KNY: then you can use pure SQL.. Mar 28 03:48:01 zinx, hmm Mar 28 03:48:06 KNY: are you sure you need the full history? Mar 28 03:48:07 KNY: and the calculations can all be done by just iterating over the rows, no need to store anything. Mar 28 03:48:12 fake averages by keeping the sum and N value Mar 28 03:48:30 jsharkey: that's no fake :D Mar 28 03:48:35 KNY: techniques like jsharkey suggests work just fine Mar 28 03:48:45 pjz, cache? Mar 28 03:49:09 KNY: keep a running total, and the N to use when calculating the average for that sum Mar 28 03:49:10 zinx, I'll look in to storing the calculations when the data is saved Mar 28 03:49:12 KNY: no, things like store the average of N points by keeping the sum of all the points and the value of N Mar 28 03:49:39 KNY: that way you dont need to calculate the sum over all each time Mar 28 03:49:44 KNY: so to update it you just add your new datapoint to the sum and increment N and etc Mar 28 03:49:47 just store the sum in one place Mar 28 03:49:49 pjz: exactly :) Mar 28 03:50:11 you mean store it in the database? Mar 28 03:50:25 it can be wherever Mar 28 03:50:26 sure, in a different table somewhere, or a SharedPreference to keep it lightweight Mar 28 03:50:30 jsharkey: if you don't care as much about precision you can just keep the average and N Mar 28 03:50:39 jsharkey: because sum = avg * N Mar 28 03:50:51 pjz: that is going to cause major precision issues as time goes on Mar 28 03:51:02 pjz: right, but that weights it towards newer values Mar 28 03:51:07 pjz: since each new operation will have precision issues Mar 28 03:51:23 zinx: hi, see my disclaimer above where I said "if you don't care as much about precision" ? Mar 28 03:51:43 lol Mar 28 03:51:54 pjz: there's a difference between caring about precision, and having use for a completely bogus value Mar 28 03:51:59 jsharkey: enh, only a little Mar 28 03:52:06 pjz: A lot. and more as time goes on. Mar 28 03:52:43 even if you use floating point math it's going to be bad.. pretty much impossible with integer math ;D Mar 28 03:53:14 zinx: depends on N and the precision of avg. if avg is a double and you only care about like 1 decimal, and N is < 1000 or so, you're preobably okay Mar 28 03:53:45 * pjz shrugs Mar 28 03:53:50 pjz: it's the difference between being 0.01 off, and being 0.01 off on 10,000 operations, making it 100.00 off. Mar 28 03:55:09 in any case, it's kinda pointless because storing it as a sum + N is just as easy, and far more accurate :x Mar 28 03:56:07 and as an added bonus, if you want standard deviation all you have to do is also store sum(value^2) Mar 28 03:56:53 zinx: I don't think the error is as big as you think it is. Mar 28 03:57:19 pjz: i don't think there's any point to storing sum/N and N instead of sum and N Mar 28 03:58:47 pjz: it only makes sense if someone's reading the data file and can't do simple math Mar 28 04:00:19 zinx: well, I stored the avg that way in assembly class b/c I could store it and display it and not have to keep sum since I would just update the avg. Mar 28 04:00:36 zinx: yay code bumming ;) Mar 28 04:00:38 what? Mar 28 04:00:58 you have to store both the sum (in some form) and N Mar 28 04:01:02 zinx: I could read the bytes I was going to display, so they were effectively free storage Mar 28 04:01:03 and you have to update both. Mar 28 04:02:12 pjz: my problem is, removing a row then adding it back may result in a different average, and so on. Mar 28 04:02:24 (and probably will, at that) Mar 28 04:03:10 so anyway, back to my question: are there handy android source jars I can download to see why I'm crashing the SDK with my app? Mar 28 04:04:03 crashing how? i don't have that in my scrollback Mar 28 04:04:37 zinx: well, eclipse says that ViewRoot.deliverKeyEvent (line 1672) threw an NPE Mar 28 04:04:47 but I dunno what's *on* that line since I don't have source jars Mar 28 04:05:05 so I'm looking for an android-src.jar that I can point Eclipse at Mar 28 04:05:11 there isn't one Mar 28 04:05:26 you can check out the source using repo, though Mar 28 04:07:31 yah Mar 28 04:07:35 that line number does line up with where a null pointer exception could be passed up, but it's not in a useful place Mar 28 04:07:40 but that's more than I want Mar 28 04:07:47 is there an earlier NPE? Mar 28 04:07:49 okay Mar 28 04:08:11 may be lower down the list or higher up it :/ Mar 28 04:08:48 (it's at the end of a 'finally' clause of a 'try' which doesn't catch the exception) Mar 28 04:08:57 so basically, "it happened somewhere in there." Mar 28 04:26:54 heh, I just opened up a huge bottleneck in my code due to my own dumbassery :( Mar 28 04:27:14 turns out I was loading all of the stuff from the database at least four times more than I needed to Mar 28 04:28:01 that'll slow down the device just a tad Mar 28 04:34:10 zinx: how about line 1666 ? Mar 28 04:50:55 what branch is the current 1.1 SDK from? the release-1.0 branch? Mar 28 07:10:00 How does one center the text in a text view? Mar 28 07:10:26 use the gravity attribute Mar 28 13:28:01 we need voip sip/rtp client@#% Mar 28 13:31:18 we need friends first Mar 28 13:35:01 * jbq needs to find a way to not sleep at night. it wastes 6 or 7 hours each time. Mar 28 13:37:52 just do like we all will do in europe tonight , change the time this night and sleep one hour less Mar 28 13:38:17 been there, done that a few weeks ago :) Mar 28 13:41:29 jbq, http://xkcd.com/320/ Mar 28 13:42:19 LOL. I actually kinda did that once. Mar 28 13:42:55 I used to do that during the summer back when I was in high school Mar 28 13:43:06 ahh, to have no responsibilities again.... Mar 28 13:49:52 The good news is that the more responsibilities I take, the less I sleep. Those days I sleep 6-7 hours a night, and I sleep an extra hour when work is less stressful and an extra hours on top of that when I'm on vacation. Mar 28 13:49:56 I guess one could also waist one our less on irc and mail every day and GTD Mar 28 13:51:23 Anyway, time to have a shower and get to the office (I can only do so much work from home). Mar 28 13:53:13 I guess telepathy (http://telepathy.freedesktop.org/wiki/) is not on the same "road" as android? Mar 28 17:25:08 Are the action and categories tags in the manifest supposed to be on the activity or the application? Mar 28 17:27:35 activity Mar 28 17:47:38 ldlework: they describe an intent-filter, which can be attached to lots of different things, including activity. Mar 28 17:48:32 jasta, I have set the view of an AlertDialog to a ScrollView that contains a TextView. When I press on the text to scroll the text "dims" any idea? Mar 28 17:50:58 is that related to your first question somehow? Mar 28 17:51:50 jasta, no Mar 28 22:18:40 is there a way to make the device retain a wifi connection after the screen blanks? Mar 28 22:19:12 wasnt there a wifi app on the market that does that :| Mar 28 22:19:26 Wifi Lock Mar 28 22:19:28 !!1 Mar 28 22:19:29 i have one!!! Mar 28 22:19:32 hmm Mar 28 22:19:36 wonder how he did it Mar 28 22:19:40 its mine :-) Mar 28 22:19:42 I need to do it from within my program Mar 28 22:19:43 i made it Mar 28 22:19:49 o.O Mar 28 22:19:57 squalus: look at WifiLock Mar 28 22:20:03 k Mar 28 22:20:11 lol yea wifi lock Mar 28 22:20:42 is the code available? Mar 28 22:20:52 squalus: hmm... Mar 28 22:21:16 ill pastebin the parts you need Mar 28 22:21:17 oh wait Mar 28 22:21:24 sweet Mar 28 22:21:33 that would be awesome Mar 28 22:21:36 void keepwifi_on() { keepmeon() } Mar 28 22:21:43 you use this? Mar 28 22:21:45 http://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html Mar 28 22:21:57 ya Mar 28 22:21:59 thats it Mar 28 22:22:28 nice ok thanks Mar 28 22:24:08 http://pastie.org/430126 Mar 28 22:28:16 thanks! Mar 28 22:29:26 no prob Mar 28 22:32:07 hmm you have a reviewer AakashPatel Mar 28 22:32:09 http://www.metserve.com/phones/wifi-lock-for-android Mar 28 22:32:43 thats not mine Mar 28 22:32:47 damn Mar 28 22:32:54 huh? Mar 28 22:33:00 http://www.cyrket.com/package/com.elsdoerfer.wifilock Mar 28 22:33:07 thats the one they're reviewing Mar 28 22:33:12 http://www.cyrket.com/package/com.patel.wifilock Mar 28 22:33:14 thats mine Mar 28 22:33:23 read what makes mine special :-) Mar 28 22:34:56 buncha tards write reviews i swear Mar 28 22:38:12 i'm trying to add a 'toggle fullscreen' function to my app. Mar 28 22:38:21 i can go from non-fullscreen to fullscreen Mar 28 22:38:33 but i can't go from fullscreen to non-fullscreen Mar 28 22:38:59 anyone know if this is the correct flag? WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN Mar 28 22:46:28 nevermind. i wasn't calling Window.clearFlags() Mar 28 23:03:55 smart people usually don't have time to write reviews Mar 28 23:04:07 k so that solved one problem with the downloader Mar 28 23:04:24 the other is that if the user closes the program my download thread gets cleaned up Mar 29 00:01:27 So AakashPatel I have one last thing to do in my program before I publish it. Mar 29 00:16:38 ldlework: what? Mar 29 00:18:10 AakashPatel, well I have an alertdialog that I set the view to a scrollview that contains a text view Mar 29 00:18:16 But when the user clicks on the text to scroll Mar 29 00:18:20 the text gets dimmed Mar 29 00:18:23 and it looks bad Mar 29 00:18:26 But I can't figure it out Mar 29 00:18:32 So I'm thinking I'm just going to publish Mar 29 00:18:34 sadly Mar 29 00:18:47 Everything else works like I want Mar 29 00:20:12 ldlework: hold on Mar 29 00:20:14 brb Mar 29 00:22:49 ldlework: okay Mar 29 00:22:52 back Mar 29 00:22:54 Hi Mar 29 00:23:05 Want to see how I'm making the alertdialog? Mar 29 00:23:10 sure Mar 29 00:24:36 ldlework: oh, its easy holdon a sec Mar 29 00:24:43 you are using autolink? Mar 29 00:24:47 http://ldlework.pastebin.com/ Mar 29 00:24:52 Yes Mar 29 00:24:59 yea we had same issue with connectbot Mar 29 00:25:02 Linkify.addLinks(tv, Linkify.ALL); Mar 29 00:25:14 tv = TextView Mar 29 00:26:05 you can get around it if you force the textColor Mar 29 00:26:18 I'm making it programatically Mar 29 00:26:19 and there is a framework ref somewhere Mar 29 00:26:24 Hopefully there is a way to do that in the java Mar 29 00:26:35 oh, sure, Mar 29 00:26:41 actaully you'll be working with colorstatelist probably Mar 29 00:26:51 I mean I guess I should just figure out how to move it to the xml Mar 29 00:26:52 just get the default color and set it explicitly to that Mar 29 00:27:21 the issue is there is a "pressed" color defined for normal TextViews, which only gets triggered when they are linkified Mar 29 00:27:30 *otherwise, they arent clickable Mar 29 00:28:21 setTextColor(getTextColors().getDefaultColor()) or something like that Mar 29 00:30:00 I think it wants me to designate what state I want to specify colors for Mar 29 00:30:05 who's familiar with the gdata api's Mar 29 00:30:12 for java desktop apps... Mar 29 00:31:34 ldlework: there is a setTextColor() that takes an int, which is what getDefaultColor() returns Mar 29 00:32:07 doing that replaces any state-based colors by always using the default Mar 29 00:32:13 It worked Mar 29 00:32:18 I really appreciate it Mar 29 00:32:22 *which means it still inherits the correct color from themes Mar 29 00:32:33 :) Mar 29 00:32:36 ldlework: whats your app do1 Mar 29 00:32:38 !!!!! Mar 29 00:32:41 haha Mar 29 00:32:42 yea its a known bug, not sure if it got fixed in cupcake Mar 29 00:32:45 Gonna figure out how to sign it Mar 29 00:32:50 And publish it now Mar 29 00:32:56 ldlework: didnt i tell you yesterday? Mar 29 00:32:58 how to sign it? Mar 29 00:33:03 For debug yes Mar 29 00:33:07 err... Mar 29 00:33:08 no Mar 29 00:33:14 that was for release also Mar 29 00:33:18 oh okay Mar 29 00:33:23 Well then I'll repeat the steps Mar 29 00:33:26 yep Mar 29 00:33:35 uh...be sure to keep the .keystore file Mar 29 00:33:44 private...and dontdelete it Mar 29 00:33:57 if you want to publish an update...you NEED that file Mar 29 00:34:19 where was the export in eclipse? Mar 29 00:34:25 right click Mar 29 00:34:31 on the project pane...on the project Mar 29 00:34:49 thanks Mar 29 00:36:03 err...gdata api treats me badly Mar 29 00:37:25 tell mee!!1 Mar 29 00:38:20 jsharkey: on the gdata api...if i download the sample version will it matter? Mar 29 00:38:27 or do i HAVE to build it from source? Mar 29 00:42:27 ldlework: lol tell me Mar 29 00:42:30 !!!! Mar 29 00:42:33 hmm? Mar 29 00:42:34 !!!¡¡¡ Mar 29 00:42:44 jsharkey: im trying to use the gdata api Mar 29 00:42:48 for finance Mar 29 00:42:49 which api are you trying to talk with? Mar 29 00:42:55 a\h Mar 29 00:43:13 i downloaded the samples one Mar 29 00:43:23 is that all i need? Mar 29 00:43:42 or do i need those activation.jar servlet.jar and that mail.jar? Mar 29 00:44:00 o.o i havent dug that deep into gdata feeds Mar 29 00:44:25 ah Mar 29 00:44:29 to simplify things, there are android permissions that you can ask for, which borrow the current user's device authentication Mar 29 00:44:35 so you dont have to prompt for their username/password Mar 29 00:44:43 which is pretty awesome Mar 29 00:44:53 thats what the google finance app in market does Mar 29 00:45:03 how did they get the charts on there? Mar 29 00:45:18 using chartserver? Mar 29 00:45:32 ... Mar 29 00:45:49 http://code.google.com/apis/chart/ Mar 29 00:46:12 does finance have a differnt chart api? Mar 29 00:46:45 idk, i think there is a way to point a data feed at chartserver so you dont have to pull the raw data to device Mar 29 00:47:31 hmm.. Mar 29 00:47:41 http://www.google.com/finance/getchart?q=FAZ&x=NYSE&p=2d&i=240 Mar 29 00:48:14 ah there ya go Mar 29 00:48:21 however, be careful not to rely on confirmed apis Mar 29 00:48:35 if that wasnt advertised as a developer api, it might suddenly stop working Mar 29 00:48:53 idk if it is or not..i just found it Mar 29 00:50:48 hmm.... Mar 29 00:52:04 You can now find my first application on the market under the name "1D Cellular Explorer" enjoy! Mar 29 00:52:07 Thanks for all the help! Mar 29 00:52:20 ldlework: ooh what does it do? =D Mar 29 00:52:37 read the description :D Mar 29 00:53:08 lol wth does it do? Mar 29 00:53:14 i thought i get it free!!! Mar 29 00:53:17 :-) Mar 29 00:53:55 c'mon....slide me the apk Mar 29 00:53:58 lol Mar 29 00:55:34 Buy it and comment on how you're glad you could help to make it so good. Support your already charity to the app ;) Mar 29 00:55:50 :-P Mar 29 00:56:02 lol i dont even a have a google checkout account Mar 29 00:56:10 not planning on making one :-) Mar 29 00:56:23 (okay..mabey i lied on that one) Mar 29 00:56:28 aww its paid :( Mar 29 00:56:31 ya Mar 29 00:56:36 and i helped!1 Mar 29 00:56:40 yuk! lol Mar 29 00:57:13 Oh come on, I want to see if its possible to make anything of this market. Don't blame me. I worked hard and its a great app. Mar 29 00:57:24 so did i! Mar 29 00:57:59 lol you took down your number Mar 29 00:58:06 lol yeah I was like WTF Mar 29 00:59:19 http://java.sun.com/products/servlet/download.html Mar 29 00:59:31 where the hell do i download the servlet.jar file from that page? Mar 29 01:01:21 i NEED that file Mar 29 01:05:32 ldlework: lol i helped you...now find that file! Mar 29 01:10:57 3/28/09 8:10:30 PM [0x0-0x80080].com.apple.JarLauncher[4748] java.lang.NoClassDefFoundError: com/google/gdata/util/ServiceException Mar 29 01:11:05 how do i fix that Mar 29 01:11:08 ? **** ENDING LOGGING AT Sun Mar 29 02:59:57 2009