Friday, January 06, 2012

(Semi-) Auto-complete your declarations

Too lazy to type the class name of the variable you're declaring? Or maybe you can't remember the exact name of the class.

Well let's say you're declaring and assigning, like this:

SomeTypeName foo = something.getFoo();

But you can't remember the SomeTypeName part. Try this instead:

String foo = something.getFoo();

Eclipse will underline the error (oh yeah, you have to be using Eclipse, but who isn't??) and all you have to do it press Ctrl/1 (or Cmd-1 if you're on a Mac) and the quick fix will pop up,

Change type of 'foo' to 'SomeTypeName'

Just hit Enter and you're done! You're welcome!! :)

Saturday, December 10, 2011

SQLite.delete with args workaround

This Android SQLite code wasn't working:

    getContentResolver().delete(LogProvider.URI, LogDatabase.COL + " < ?", new String[] { Long.toString(lval) });

But this code does:

    getContentResolver().delete(LogProvider.URI, LogDatabase.COL + " < " + Long.toString(lval), null);

Don't know if it's a bug in SQLite or in the way I was calling it. Doesn't matter, it's an easy enough workaround. Hope this saves somebody else some trouble!

Monday, December 05, 2011

Ballot Experiment

GraniteGeek at the Nashua Telegraph is doing an experiment with multi-choice ballots, and anyone can participate! Wish you could endorse Buddy Roemer's effort to get money out of elections? Afraid to vote for the candidate you truly like best because you would be "throwing your vote away"? Here is a chance to play with a system that fixes all that... Give it a try!

Survey

Friday, October 14, 2011

how to get screen to stay on when plugged in? - Android Forums

Want to listen to music with your Android device plugged in and keep the screen from shutting off? I did, and it was driving me crazy! I found the answer at Android Forums -- it's in Settings under Development, of all places!!

Thursday, October 06, 2011

createElement + iframe = NO

Don't use createElement to create IFRAME elements.

IE doesn't like it. Click here for the details and a workaround.

Wednesday, August 31, 2011

Droid2 Unrooting

I'm unrooting my Droid2 in case I ever need it to have that new-droid smell.

Anyway, here are some links I found useful:

Here are the instructions for getting RSD Lite and the SBF file you need:
http://droid2hacks.com/droid-2-hacks/how-to-unrootunbrick-droid-2-back-to-factory/

And here is a tip on what to do when you're stuck at "Please manually power up this phone" -- just go back into the bootloader (up-arrow/power) and plug back in if you became unplugged. Part of my problem may be that I was running under Parallels and I goofed when it asked me to retain the USB connection to the phone.

Anyway, here's the other thing. When you're done, if you go to your settings and it has forgotten your phone number, no need to panic. From here I learned that by dialing *228 and hitting SEND you'll connect to the automated programming system. You'll hear stuff in the earpiece but if you pull the phone away from your face, you'll actually see the phone telling you it's being programmed. As in activated.

And Here's something else I didn't know. When I was done, I still had all of my apps. I'm not sure how this is possible. I expected everything to be wiped out. Did I do it right? Did the flash really happen? I'm assuming that it did, since my phone had to be reactivated onto Verizon's network. Oh well, it does seem to have worked!

Thursday, August 11, 2011

Add UIBinder widget to root panel

This page from the GWT doc is very helpful for getting start with UIBinder.

And they give this example for adding your UIBinder object to your application:

Document.get().getBody().appendChild(helloWorld.getElement());

Maybe that's OK for an HTML UIBinder. I haven't tried that.

Instead, I was using GWT widgets in my UIBinder, and I wanted to add a ClickHandler to one of my buttons. But nothing ever happened when I clicked it. Turns out, as I read on Stack Overflow, that indeed the handlers aren't initialized properly unless you add to the root panel.

So here's what I did that worked just fine:

RootPanel.get().add(helloWorld);

Thanks, Hilbrand!

Wednesday, August 10, 2011

Got default constructor?

got this error?

was not included in the set of types which can be serialized by this SerializationPolicy

could be you're missing a default constructor, like I was.

thanks, holyjeez!!

Sunday, July 31, 2011

sls (combination of ssh and ls)

Here's a little bash script I just wrote and thought somebody might find useful. I'm always moving files around using scp and also needing to ssh around to ls them. So why not combine the ssh and the ls into sls -- just like scp, right?

Here are the usage and help text...

usage: sls [ls-option]... user@host[:file]...

sls is a magical combination of ssh and ls. Simply give the sls command some (or no) ls options and one or more remote locations and you'll get a listing for each. The remote spec is the same user@host:file specification you would use with the scp command, and the file part is optional.

And here is the script itself. If you have any fixes or improvements, please let me know.

p.s. Blogger, when I write a post in HTML, please let me edit it the same way... thank you. And to visitors from the future, if you find yourself needing to edit your HTML-written post, it's actually easy now that I think about it. Just ask your browser to show you the source, grab what you need, and paste that back into the post editor.

Thursday, July 28, 2011

Deploying GWT

I'm ready to try deploying my GWT app to WLS... so how u do dat?

I found a handy how-to on elitecoderz.net.

Thanks, Erik!

Tuesday, July 26, 2011

GWT widgets with radio buttons

Here's something I learned today.

First the problem, which was that setValue didn't seem to be doing anything -- my radioButton's weren't getting set. This isn't actually true. It turns out that if I scrolled down, one of the radio buttons on the page WAS getting set. Can you guess what was going on? That's right, all of the radio buttons from all sets all had the same name.

Heres the lesson: If you make a GWT widget that has radio buttons in it, and you use more than one of these widgets on a single page, you're going to need to make the name of each radio set unique.

And my solution: What I did was to use the hashCode of the panel that contains the buttons, and this worked just fine.

You're welcome!

Sunday, July 24, 2011

Summer nest boxes

This is mainly a note-to-self about how to make summer nest boxes, the kind that are open on top. I'm always forgetting the dimensions.

Cut from a 1"x10"...

- a 4" piece for the front
- a 7" piece for the back
- a 17.5" piece for the bottom
- two 17.5" pieces for the sides

The front and back stand on top of the bottom, such that the interior length of the box is 16".

The sides and bottom rest on the same surface, such that the exterior width of the box is 10.75".

If you cut the 17.5's short by the width of your saw blade, you should be able to get three nest boxes out of two 8-foot boards -- one board for five 17.5's and two 4's and the other board for four 17.5's, one 4, and three 7's.

Which nails to use? I'll be back to answer this all-important question.

Saturday, July 09, 2011

Google+!!

That's a lot of punctuation.

But here I am!!

https://plus.google.com/110123658033707277435

Friday, July 01, 2011

Fun with Eclipse on Mac OS: the command/option saga

When I tried to run Eclipse on my Macbook Pro the other day, I discovered that the command and option keys were reversed. If I tried to Paste with cmd-V, I'd get some funny character, but if I typed opt-V, it would paste. Instead of quitting, cmd-Q would insert this "œ" character, which is supposed to be input via opt-Q, which instead would quit me from Eclipse. Yeah, loads of fun.

I googled all around and found nothing, nothing at all, about this. The only other thing I could think of was to submit a bug (this one) and hope that someone could point me to some page about a gotcha... or whatever.

Well the plot thickens. Turns out that if I create a new user account on the Mac, that user doesn't have the same problem. So at least I know it's not even something about my system, but rather about my normal user account. So if I can't figure out, the worst case solution is I have to switch users to run Eclipse. Maybe I'd just switch to a new user account instead and move all my stuff to it.

But before I do all that, I'll see if I can figure out what it is about my account that's causing this. If I find any answers, I'll be posting them here.

Update: I tried a bunch of things -- moving all of the Preferences out of ~/Library, moving .* out of ~, moving Application Support files... I finally got fed up and just created a new account. Oh what fun this will be! :/

Wednesday, June 29, 2011

Kensington Universal Multi-Display Adapter

This is kind a note-to-self, but maybe it will help somebody else some day.

I've got a Kensington Universal Multi-Display Adapter hooked up to my Mac Mini, so I can have two displays. Works really great, but... whenever the power goes out and the system shuts down, I'll start it back up and that monitor is dark, dead, like a paperweight.

Want to know what I did to fix it? It's really complicated. Unplug the adapter from the system and plug it back in. Yes, that's all. Only took me an hour this time to think of that. Maybe next time I'll google it and end up back here and ::facepalm:: suffer for only a few minutes.

You're welcome, self!!

TweetDeck

I've tried a few different Twitter/Facebook apps, but just tried TweetDeck... LOVE IT!! SWITCHED!!
Try it yourself, it's in the Android market: here.

Update: one thing I found kind of annoying is that I couldn't figure out how to switch the order of the columns. Maybe someone can give me a better idea how to do this, but I ended up jotting them down, deleting them (the "home" and "me" columns can't be deleted) and re-adding them. Hey, it worked!

Sunday, June 26, 2011

Speaking of Ubuntu (which rocks, by the way)

Hey, speaking of Ubuntu, I didn't mention that I upgraded to 11.04 (natty what?) and have not had a single problem since with the whole suspend/restore on this Dell Latitude C640 that I sometimes use. Thanks, Ubuntu -- you all rock!!

Installing Eclipse (on Ubuntu, of course)

It sure is nice to have the package manager for installing software, but sometimes it's out of date. In the case of Eclipse, I think it gave me the G release, whatever that was, but the latest is Indigo, which you can download from whereverz. And I found a handy page explaining how to "install" it.

Wednesday, June 22, 2011

SCP and spaces

I was looking for help with linux SCP and spaces in file names. I found a somewhat helpful link here: http://www.thingy-ma-jig.co.uk/blog/14-05-2007/how-to-scp-a-path-with-spaces

Its advice didn't work for me out of the box, however.

What I ended up doing instead that did work was this:

scp -r 'myserver.com:"/path/with/a/Space\ In\ It' ./

Which is to say that I single-quoted the whole source argument and single-escaped each space.

I'm dealing with left-parentheses similarly:

scp -r 'myserver.com:"/path/with/a/Space\(s)\ In\ It' ./

Looks like there are other characters I need to escape, like single quotes, but I'm not going to worry about those right now. If you have any idea about escaping those in this context, please leave a comment.