Wednesday, July 31, 2019

EXIF metadata with a Promise

I had occasion to use exiftool recently, but instead of a callback, I'd rather use promises.

This is what I came up with:

const exif = require('exiftool');
const util = require('util');

const exif_metadata = function (data) {
    return new Promise((resolve, reject) => {
        exif.metadata(data, (err, metadata) => {
            if (err) {
                reject(new Error(err));
            } else {
                resolve(metadata);
            }
        });
    });
};


Worked great!

const fs_readFile = util.promisify(fs.readFile);
 

Promise.resolve()
  .then(() => {
    return fs_readFile(path);
  })
  .then(data => {
    return exif_metadata(data);
  })
  .then(metadata => {
    console.log('metadata: %O', metadata);
  })
  .catch(error => {
    res.send(error.toString());
  });

Saturday, July 27, 2019

Add Port to UFW

I'm running UFW (uncomplicated firewall) to restrict traffic into my Linux system.

And while being super restrictive is generally a good thing, there are times when you have to poke a new hole and connect from another system inside the house.

Usually it's a new app running on a new port and since I never remember the command to allow this, here it is:

$ sudo ufw allow from 192.168.1.0/24 to any port 3100

You're welcome, future self!

Saturday, July 20, 2019

The DX-M04 Shelving System

My dad bought a DX-M04 shelfy thing and I was tasked with its assembly.


I don't think a nicer set of shelves can be had at any price. And do you see the little screwdriver pictured in the instructions? YES, the DX-M04 really does come with a screwdriver!! And the bottom panel (part #3) has feet. Yes, they really did think of everything.

If I could make one suggestion:

At step three, you might want to leave the bottom a little loose, so when, in step four, you insert the back, you can wiggle it into the groove in the bottom. Then after you've installed the top in step five, you can go back and tighten the bottom.

If you need some shelves, you can't go wrong with the DX-M04. No, no idea where you'd buy them, but for the right price, I can put my hands on a really well assembled set.

Friday, July 19, 2019

MySQL CRAZIES

Did you install a new MySQL and things just aren't working the way you're used to?

WHAT?? ME TOO!!

In this case, I'm inserting just a few columns, and there are non-specified columns without default values.

In my other database it just works - I know, not correct behavior, but it's what I'm used to.

In my new database I get this error:

ERROR 1364 (HY000): Field 'xxx' doesn't have a default value

So what's the difference?

STRICT MODE

Thanks, documentation!!

Before, strict mode. Giving me an error...

mysql> select @@GLOBAL.sql_mode;

+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode                                                                                                                         |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


After, non-strict mode. Working like my other database!

mysql> SET GLOBAL sql_mode = '';
Query OK, 0 rows affected, 1 warning (0.00 sec)

Tuesday, May 14, 2019

MySQL Passwords

I'll never remember this unless I write it down here. And hey, maybe it will help somebody else.

Problem:

  • MySQL version 8+
  • github.com/go-sql-driver/mysql
  • db, err = sql.Open("mysql", "username:password@/database")
    (no error)
  • query, err := db.Query("SELECT * FROM TABLE")
    this authentication plugin is not supported

Solution:

mysql> alter user 'username'@'localhost' identified with mysql_native_password by 'password';

See also: https://github.com/go-sql-driver/mysql/issues/785

Friday, March 08, 2019

How to Cook Chicken

This one, too.

375 degrees for 20 minutes, was it?

WIP: I'll note more detail next time.

How to Cook Salmon

I'm going to forget if I don't write this down.

- 1 lb salmon
- couple TBS oil
- Fish seasoning (salt, etc)

425 deg, 25 min

WIP: I'll write down more about this when I get a chance

Wednesday, February 06, 2019

My Very Own Burrito Recipe

I believe it was Benjamin Franklin who first said, "eat a burrito a day."

His recipe has been lost to the fog of time, but here's one I think he would like:

Makes two good-sized burritos

Ingredients

  • 1/4 lb., your choice of meat, cooked (alternatively 1/2 cup of cooked beans)
  • 1/2 cup, cooked rice
  • 1/2 cup, grated cheese - I used cheddar
  • 1/4 cup, salsa
  • two 10-inch flour (or gluten-free) tortillas

Steps

  • Mix it all up (everything but the tortillas, of course) in a microwave-safe dish (or fire-safe, if you're into that kind of thing).
  • Heat (microwave, fire, etc) the mixture until the cheese is melted
  • Give it all a good stir
  • Divide the melty mixture between the two tortillas, flattening and shaping it so as to create proper burrito-shaped innards
  • Fold the two sides toward the middle, then the near end over the center; finally flop the middle part onto the other end of the tortilla - please don't make me draw a diagram
Garnish the tortilla with a little more cheese, which then melt


Serve with a little more salsa, some Spanish rice, maybe some refried beans.

And enjoy!

Monday, December 31, 2018

Onion Dip Experiment #2

It's time to try the onion dip recipe again.

Here are my notes from last time.

Here's what I'm doing this time...

Ingredients
  • 2-3 small-medium onions (2 cups finely chopped)
  • 2 TBS unsalted butter
  • 3/4 tsp Kosher salt
  • 1/8 tsp pepper
  • 2 cups, plain yogurt
  • 2 TBS chives
Directions
Chop the onions finely. Try not to cry. They're just onions.

Melt the butter. Add the onions and 1/2 tsp salt. Cook until golden brown. You'll know they're golden brown when a spouse or other responsible adult tells you you're golden brown. It should take about 30-35 minutes.

Put the cooked onions in a tightly covered dish and refrigerate until cool. While you wait, you can tweet or write a blog post about the experience.

Once the onions are cool, mix them in a medium bowl with the yogurt, 1/4 tsp salt, the pepper, and the chives.

I know I said I was going to try adding cayenne pepper. We'll see about that, and I'll let you know. Nah, I think it's perfect as-is.

So as promised, the sodium content. The TOTAL sodium in the whole recipe is just about 1000 mg:
  • onions: 8 mg
  • unsalted butter: 0 mg
  • 3/4 tsp kosher salt: 840 mg
  • pepper: <1 mg
  • yogurt: 150 mg
  • chives: 0 mg
So one eighth of the recipe (about 1/4 cup) would have about 120 mg of sodium.

Let's compare this with Lipton's onion soup mix. The mix itself has 610 mg. The sour cream adds another 40-something.

This recipe reduces the sodium by more than 80%. That's quite a savings!!

Can we get that number up to 96%? Stay tuned, I'll try that in a couple weeks!

Tuesday, December 25, 2018

Sausage Bread

Originally from an old friend of the family.

Sausage Bread

  • 1 box of hot roll mix
  • 1/4 cup Parmesan cheese
  • 1/2 cup grated Swiss cheese
  • 2 eggs beaten
  • 1/4 tsp Tabasco
  • 1/2 tsp salt
  • 2 tbsp parsley
  • 1 onion chopped
  • 1 lb sausage, hot or sweet

Mix dough according to directions on box. Let rise 45 min. Roll out 1/4" thick oval. Cook onions wish sausage (not brown). Drain excess fat. Add all other ingredients. Stir until cheese has melted. Let cool. Don't spread to edges. Roll up and pinch ends together. Shape into crescent. Place on greased cookie sheet (with edges). Bake 20 min at 400 degrees until brown and toothpick comes out fairly clean.

I'm going to try and make this with gluten free bread dough sometime soon. I'll report back.

Sunday, December 23, 2018

Italian Wedding Soup

I found this great recipe for Italian Wedding Soup.

I used a one-pound box of baby spinach for the greens.

Instead of the three kinds of meat, I just used a pound of ground turkey.

Gillian's (unseasoned) gluten free bread crumbs worked very nicely.

I made the meatballs smaller - about 3/4 inch - which I find much nicer for soup.

And when you put them into the broth, it's a good idea to count them, so you know just how many you have if you're divvying them up for a large crowd. This batch served thirteen people as a soup course with a couple cups left over.

The spinach and puffed-up meatballs insisted on floating to the top, so swirling in the egg and cheese mixture was a bit difficult. I actually removed a bunch of it to perform this step!

Also worth noting: The meatball parsley should be chopped finely. And the recipe calls for a teaspoon of minced garlic - two cloves in the garlic press was just the right amount.

Garnish means "don't eat me" in Italian. Next time I'd use whole leaves of parsley and more coarsely grated cheese. (yes, eat the cheese)

Here's a pantry/fridge/freezer/shopping list for your convenience:

3 quarts homemade chicken stock (I might have used four? sorry, not sure)
1 lb. ground turkey
1 cup unseasoned (gluten free for my needs) bread crumbs
1/8 lb. Parmigiano-Reggiano (sorry, not sure how much I actually used)
3 large eggs
a medium onion
a bunch of fresh parsley
two cloves of garlic
kosher salt
black pepper grinder

Tuesday, December 11, 2018

Onion Dip Experiment #1

I love onion dip. Who doesn't? People on low-sodium diets, that's who. And besides, who wants all the crap that's in those processed soup packages? Not me, thanks!

So I went looking for an onion soup recipe to play with, and I found this one. My plan was to make it the first time exactly as written, but since I had some sour cream left over from Hanukkah, I combined that with some plain yogurt (Siggi's). And instead of unsalted butter and salt, I used the Land O' Lakes spread we had in the fridge. The rest of the salt I figured I would leave out.

The mixture is way too thick for my taste, so I think instead of the cream cheese, I'll stick with all yogurt next time - Greek or Icelandic.

My dip seemed a little bland, so I added some garlic powder. I guess I wish I'd read the original recipe's comments section, because somebody suggested adding a little cayenne pepper. That seems like a better idea.

Another commenter suggested getting a better texture by putting the cooked onions through a food processor.  That seems like a lot of work, so I think next time I'll chop the onions instead of just slicing them before cooking them.

Now as for the salt, the recipe calls for cooking with a half teaspoon of salt, which I left out, though I did use a buttery spread containing about 25 mg of sodium per serving of dip. The additional quarter teaspoon of salt the recipe calls for only adds another 30 mg of sodium per serving, so I think next time, I'll leave it in. The overall sodium savings compared with processed soup mix has to be at least 500 mg. Once I have the recipe perfected the way I like it, I'll do that math.

One more thing, I put a small container in the freezer. I'll thaw it out next week and see if it's any good. Update: I froze a 5 oz yogurt container of the original unsalted recipe. It was in there for about a week and then I put it in the refrigerator for about a day to thaw. The texture was just as it was, still too thick for my taste. And taste, just the same. I would have added some cayenne, but dang it, there wasn't any in the cupboard. That will have to wait for experiment #2.

UPDATE: read all about Onion Dip Experiment #2!

Monday, November 26, 2018

Soup: Split Pea with Turkey

Thanksgiving took place under my roof, so naturally I took custody of the turkey carcass - with an eye toward soup, of course! On the other hand, I've had a hankering for split pea soup, but preferring to avoid all the sodium that ham is full of.

Enter this recipe. I used turkey broth instead of chicken. And instead of ham, I used the turkey that boiled off the bones during the broth-making. And I left out the salt (and forgot about the pepper).

It's really good!

There's still plenty of broth left over, some of which will turn into Sherry Noodle Soup. But I also plan to make a batch (or half batch) of split pea with a cup of water swapped out for sherry. UPDATE: I swapped 1/2 cup water for sherry, which really helps when you cook without salt. It was a great addition!

Saturday, November 17, 2018

Apache Reverse Proxy for Microservice Subdomain

You've got Apache 2 running. What more does a plain-old simple HTML site need, after all?

Now you want to add a microservice, but you don't want to add more hosting. Can you add it to this existing host? Yes you can!

Here's how to add a subdomain - tictactoe.example.com - that will send requests to your microservice that's listening on port 8888.

Put the following in /etc/apache2/sites-available/tictactoe.com.conf

<VirtualHost *:80>
    ServerName tictactoe.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ProxyPass "/"  "http://example.com:8888/"
    ProxyPassReverse "/"  "http://example.com:8888/"

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


Then add your site:

sudo a2ensite tictactoe.com

The best part is your Go code (or Rust, Ruby, Python, whatever) can just handle HTTP. You can use Let's Encrypt/certbot to add the HTTPS virtual host that will proxy secure traffic to your microservice as well.

UPDATE: Nothing like getting an invalid command error trying to do this on an Apache without proxy enabled. So...

sudo a2enmod proxy_http

Sunday, November 11, 2018

All kinds of Ubuntu troubles (fixed)

All three kinds of Ubuntu troubles (all of them fixed)

1. Can't get Ubuntu to start up without using recovery mode? Try making this change in /etc/defaults/grub

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" 

But then don't forget to

$ sudo update-grub

I've lost track of all the sites I looked at that steered me in the right direction, but I was still having trouble because I'd forgotten the update-grub step!



2a. Trouble getting VNC to install and start up? Look no further than Ubuntu's own Screen Sharing feature!

2b. Once I got that working, I discovered that I could not connect using:
  • the RealVNC viewer (error: "Unable to connect to VNC Server using your chosen security setting. Either upgrade VNC Server to a more recent version from RealVNC, or select a weaker level of encryption.")
  • MacOS Screen Sharing (error: "The software on the remote computer appears to be incompatible with this version of Screen Sharing.")
Fortunately I found a video explaining the solution. Install and launch dconf Editor. Then navigate to org > gnome > desktop > remote-access and turn off the require-encryption option. Once I did this, I was able to use all of my VNC clients!

Thursday, November 01, 2018

Git won't Pull

Problem: cannot connect to remote

$ git pull
nc: getaddrinfo: nodename nor servname provided, or not known
ssh_exchange_identification: Connection closed by remote host

fatal: Could not read from remote repository.

$ git remote -v
origin git@github.com:blah/blah (fetch)

origin git@github.com:blah/blah (push)

$ cat .git/config
...
sshCommand = ssh -o 'ProxyCommand=nc -X connect -x blah:80 %h %p'
...

Aha!

Possible solution: remove sshCommand line from .git/config unless you are ALWAYS connecting through the proxy server.

Friday, October 26, 2018

Sherry Noodle Soup (v2!)

Back in the day, you could find my recipe for Sherry Noodle Soup on dave-net.com. Well that old domain is long gone. And sadly, I don't think you can even find it on The Wayback Machine!

But I found it on a hard drive and decided to cook up a batch. But nah, that recipe needed a little tweak here and there. So without further ado, here's version two...

Sherry Noodle Soup

Ingredients:
  • A couple chicken bodies or one turkey frame, with a little meat left on (you'll want about two cups of meat off the bones later)
  • 3 quarts, water
  • 1 medium-large onion (half quartered, half chopped)
  • 2 tsp, salt (if you really must)
  • 1 cup, dry sherry
  • 1½ tsp, oregano
  • 1 tsp, thyme
  • 1/8 tsp, ground black pepper
  • 2 cups, chopped carrots
  • 2 cups, chopped celery
  • 2 cups, raw mushrooms (optional)
  • 1 lb, cooked pasta (or dry + ??? cups, water TBD)

Combine meaty bones, water, half of the onion (quartered) in a large pot. Bring to boil and then simmer for an hour or so.

Remove everything from the broth. Salvage whatever meat you can from the bones. Discard the bones and the soggy onion and the other yucky stuff. Set aside two cups of meat for later. The rest will make a nice sandwich! you can give to your dog! ONLY GIVE MEAT TO YOUR DOG IF YOU LEAVE OUT THE ONION.

Strain the broth. If you like, you can let it cool and skim the fat off the top.

Combine the broth with the meat and the rest of the raw onion (chopped) and everything else except for the pasta, which you should save for later. Bring it all to a boil and then simmer for 30 minutes.

Add the pasta (cooked or dry plus ??? cups of water) and simmer for another ten minutes or so.

Enjoy!!

Update (12/11/18): I made this with mushrooms for the first time the other day, and I really liked how it turned out!

Saturday, June 16, 2018

Fix your iTunes names (and numbers!)

I made a thing!

https://github.com/dldnh/fix-itunes-names

When Amazon announced they were retiring their Music Storage Subscriptions, I decided to download all of my music.
This was troublesome in a number of ways. The metadata was pretty well screwed up, so there would be songs without an artist name or album name. So I ended up downloading just one album at a time, so I would know which album was which. Yeah, total PITA.
But once that was done, I found I had a number of songs with names like 'dd-tt- Title of the Song' where dd is the disc number and tt is the track number. And thankfully so, since some of these tracks didn't have the disc or track number in the metadata.
So what I've done is made this little AppleScript (called Fix_iTunes_names.scpt) that will go through all of the songs and rename them from 'dd-tt- Title of the Song' to just 'Title of the Song' - but ONLY IF dd matches the disc number and tt matches the track number. So totally safe!
And then I added another Applescript (called Fix_itunes_names_and_numbers.scpt) for more adventurous folks that will also rename songs from 'dd-tt- Title of the Song' to just 'Title of the Song' and ALSO set the disc number and tarck number to dd and tt - but ONLY IF either number was blank to start with.
You don't have to buy me a beer or anything, but if you want to, feel free - and thanks! http://paypal.me/dldnh

Sunday, February 11, 2018

Use curl to test nginx rewrite rules

Be very careful using nginx rewrite. Consider this answer on SO:

The answer author wrote this correct rewrite rule:
location  /foo {
  rewrite /foo/(.*) /$1  break;
  proxy_pass         http://localhost:3200;
  proxy_redirect     off;
  proxy_set_header   Host $host;
}
Which was later edited erroneously:
location  /foo {
  rewrite /foo(.*) /$1  break;
  proxy_pass         http://localhost:3200;
  proxy_redirect     off;
  proxy_set_header   Host $host;
}
That very subtle change causes nginx to redirect, which is undesirable.

This can easily go unnoticed without curl testing:
$ curl -i http://localhost:8080/foo/bar
HTTP/1.1 301 Moved Permanently
Server: nginx/1.13.8
Date: Sun, 11 Feb 2018 14:18:12 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 40
Connection: keep-alive
Location: /bar

<a href="/bar">Moved Permanently</a>.
I've edited the answer back to the original.

Here's a great article about setting up nginx for serving Go apps.

NOTE: you'll need the GVM readme for an up-to-date command to install GVM.

Friday, December 15, 2017

ISP's and Markets

​The idea that an ISP can collect money from a content provider because a consumer requested content is like saying Safeway should be able to charge Kellog's for the Pop-Tarts I want to eat.

Just wait until Disney starts telling Time Warner to pony up for all the Toy Story they've been carrying. The real problem is that consumers have little or no choice of ISP. Each ISP has a practical monopoly in the markets where they operate.

In order for a free market to be a solution to some problem, there has to be a choice. I may choose from a variety of content providers, but I don't get to choose my cable company.

If a consumer doesn't like the way their ISP is regulating content, they should be able to choose a different ISP. But they can't. Maybe it's time we start regulating ISP's like the monopolies they really are.

Sunday, July 09, 2017

When resources unavail

Every so often my Linux system starts feeling poorly. Firefox will hang and won't let me close its window. So I ALT-TAB over to my terminal window to kill it.

$ ps -fewww | grep -v grep | grep firefox
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: Resource temporarily unavailable

When this first happened, I figured I would reboot and that, of course, would fix it. But I couldn't even run shutdown! That's when I thought of this extremely inelegant but useful solution:

$ cd /proc
$ kill *

And that freed up enough of whatever that I could get on with the reboot and then with my life.

When it happened today, I googled around and saw saw solutions suggesting...
  • su root and (WRONG: can't su)
  • ps blah blah and (WRONG: can't ps)
  • ulimit (hmmm... OK I'll try that.)
This particular solution suggests setting NPROC (max user processes) using ulimit -u like so:

$ ulimit -a
...

max user processes              (-u) 2047
...

$ ulimit -u 2100

Upping that value allowed me to kill and restart Firefox without rebooting!!

Thanks, IBM!!

Friday, March 24, 2017

Mac + Virtualbox/Linux ALT=CMD

By default it seems that when you run Linux in Virtualbox on a Mac, ALT will be mapped to the OPTION key and SUPER will be mapped to CMD.

It's much more natural to swap these, i.e. to map ALT to CMD.

And here's how you do it:

Create ~/.Xmodmap containing...

clear mod1
clear mod4

keycode 133 = Alt_L NoSymbol Alt_L
keycode 64 = Super_L NoSymbol Super_L

add mod1 = Alt_L
add mod4 = Super_L


And then

$ xmodmap ~/.Xmodmap

Enjoy!

Monday, January 23, 2017

VNC + Mac OS + Option Key = WINNING!!

I love my Macs, but sometimes through no real fault of their own, they can be a bit of a pain in the butt.

Take the Option Key. Very helpful if you're using the Finder.


Ever try using the Option Key when you're connected remotely to your Mac Desktop using VNC? It just doesn't work. VNC settings, nothing.

But I have discovered a solution. Simply turn on Sticky Keys and use the Keyboard Viewer. Now you can use your mouse to press the Option Key - not ideal, but in a pinch, it's better than nothing!

Here are the step-by-step instructions for setting this up:

1. Open up the Preferences


2. Choose Accessibility


3. Turn on Sticky Keys



4. Go back to Preferences and choose Keyboard


5. Turn on "Shoe keyboard and emoji viewers in menu bar"



6. Open up the Keyboard Viewer


7. Now whenever you need to hold down the Option Key, tap it in the Keyboard Viewer


8. If you didn't have Sticky Keys turned on, you'd have to keep it held down in the viewer, but you can just tap it the once. Tapping it again puts it into some other state. Tapping it a third time turns it off. So whenever I want Option, I double click it in the viewer. Then I do whatever it was that needed the Option Key in the first place. And then I tap it again to turn it off.

I hope you find this helpful!

Saturday, December 24, 2016

#selector vs Selector

TLDR: In Swift 3, use #selector instead of Selector (see here).

The warning (No method declared with Objective-C selector 'swipedLeft:') should be your first clue that there's a problem...



If you use this code in Swift 3, the left-swipe will result in an error like this:

2016-12-24 08:15:12.645 SpriteSimpleGame[65853:2987246] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SpriteSimpleGame.GameScene swipedLeft:]: unrecognized selector sent to instance 0x7fb99e4101f0'

Worst of all, examples like this are all over the place because leaving out the colon results in a similar error.

Thanks to this answer I learned that what you want instead is this:

let swipeLeft = UISwipeGestureRecognizer(
    target: self,
    action: #selector(swipedLeft(sender:))
)

Thanks, internets!!

Friday, September 09, 2016

VNC black screen of sadness

Did you connect to your VNC server only to be greeted by a black screen of sadness? 

It happened to me not long ago and I don't know what made me try this, but here's what fixed it:

$ vncpasswd

As always, you're welcome.

Monday, June 20, 2016

Old code, new Xcode

When you download some old code from the Interwebs with such like:

[self.window addSubview:self.viewController.view];

and it runs just fine... and later you update Xcode and start getting runtime errors:

Applications are expected to have a root view controller at the end of application launch

Fortunately the fix is easy:

[self.window setRootViewController:self.viewController];

Thanks, Interwebs!!

Saturday, April 23, 2016

LED Dice!

They cost me all of my diamonds, but I think it was worth it!


Thursday, April 07, 2016

Major accomplishment

I did it!! I beat the Cheshire Cat in Yahtzee Buddies!! 


The dice are cool and all, but pretty hard to read...


I'll stick to my favorite bronze dice.

Sunday, January 10, 2016

Beach Ball!!!

I finally got my beach ball dice! Yes, I had to beat 25 different opponents in 24 hours, but it was totally worth it, right? Right? 



But here's the thing. There's a bug - at least on iOS - where the progress of your wins against different opponents isn't getting updated. So if you want to earn the beach ball dice, KEEP A LIST OF THE PLAYERS YOU BEAT (and when) and then paste that information into a help request so customer service can give you credit for your achievement, as they did do for me. Thanks, Yahtzee! 

Now here's my whole lineup of dice. I do expect this will be my final update, since the remaining locked dice involve tournaments and dice masters that are impossible to beat without spending moneys on bonus rolls. C'est la vie! 


Saturday, January 02, 2016

Yahtzee!!

My dice. Don't judge me. :-)

Friday, January 01, 2016

Swift selector argument - yes you can!

Selectors are an Objective C thing, but sometimes you have to use them in Swift.

For example, if you are calling performSelectorOnMainThread to work around the problem between GCD and UIWebView that causes hangs in stringByEvaluatingJavaScriptFromString (see here) you don't have a choice.

But how to pass an argument? I defined my selector function to take AnyObject? just as I assumed I should since withObject:AnyObject?

So tl;dr - here's what I was doing wrong. The colon at the end of the selector DOES MATTER. Well duh, of course it does, because it indicates there's an argument. Here's an example of everything working correctly...

  private func caller() {
    let arg = 42
    performSelectorOnMainThread("myfunc:", withObject: arg, waitUntilDone: false)
  }

  func myfunc(arg: AnyObject?) {
    guard let n = arg as? Int else {
      print("how did we get in this cornfield?")
      return
    }
    print("and here we are with our arg n: \(n)")
  }

...and the proof of the pudding - my, how tasty!

and here we are with our arg n: 42

I hope this saves somebody else a few hours of struggle!

Thursday, December 10, 2015

What To Wear

Because I never ever remember...
°F Just Right Too Much Not Enough
56
  • warm wicking T
  • tech long sleeve T
  • shorts
  • didn't need the hat or gloves or extra LST n/a

    Wednesday, November 25, 2015

    Handy howmany commandy

    Here's a handy little bit of... well it isn't really SQL, is it? Shell scripting and SQL*Plus, more like.

    tcsh & csh


    alias howmany "echo 'select count(*) from table;' | sqlplus -s 'xxxxxx/xxxxxx@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxxx)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxxxxx)))'"


    sh & bash


    alias howmany="echo 'select count(*) from table;' | sqlplus -s 'xxxxxx/xxxxxx@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxxx)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxxxxx)))'"

    (for ksh use either) - and then...

    $ howmany

    Enjoy!

    p.s. I'd love to add a pipe to

    sed -e '/^$/ d; s/^\s-*//g'

    but the dollar sign screws things up, at least in tcsh. Oh well!

    Wednesday, November 18, 2015

    Sunday, November 15, 2015

    Hard-to-read Podcasts

    If you use the iOS Podcasts app, you've probably had occasion to swear at the producers of a podcast for their graphics and how they translate into dark text on a dark background. It's even worse in low light.


    Well swear no more! At least not about this. It turns out there's a setting for that! Unfortunately, because this is iOS, you have to open the Settings app. Go there and choose Podcasts. And there aren't that many settings, so find this one, Custom Colors, and turn it off


    And enjoy more podcasts!

    Saturday, November 14, 2015

    Don't take checks from strangers

    I don't tend to be alarmist, but this article has an important warning... when you deposit a check, everything you write on it can go back to whoever issued it - your account number, social security number... huge identity theft problem. 

    http://www.westernjournalism.com/alert-people-are-getting-checks-in-the-mail-from-walmart-when-they-deposit-them/


    Wednesday, October 07, 2015

    Emacs cleanup

    Because I'm always needing this between tasks...
     
    ;; kill buffers visiting /scratch or /tmp files
    (defun cleanup ()
      (interactive)
      (let* (
             (n)
             (list)
             (file)
             )
        (setq list (buffer-list))
        (setq n 0)
        (save-excursion
          (dolist (elt list)
            (setq file (buffer-file-name (get-buffer elt)))
            (if (and
                 file
                 (or
                  (string-match "^/scratch/" file)
                  (string-match "^/tmp/" file)
                  )
                 )
                (progn
                  (if (kill-buffer elt)
                      (setq n (+ n 1))
                    )
                  )
              )
            )
          (message "Delete %d buffer%s." n (if (= n 1) "" "s"))
          )
        )
      )

    Wednesday, August 26, 2015

    I Repeat...

    I'm always forgetting how to repeat a command. Here's how in tcsh:

    $ repeat 9999 sh -c 'now=`date +%s` ; date > /tmp/tmp ; then=`date +%s` ; diff=`expr ${then} - ${now}` ; echo xxxxx ${diff} xxxxx ; if [ ${diff} -gt 0 ] ; then date ; fi ; sleep 15'

    (The inner command is /bin/sh, of course)

    Saturday, January 03, 2015

    Hot and Sour Matzo Ball Soup

    Ingredients:

    • Swanson Chinese hot and sour broth 
    • more broth (h&s or vegetable, optional)
    • a can or two of mushrooms
    • a scallion or two, chopped like you do
    • matzo balls, prepared as directed on the back of a can of Manischewitz matzo meal
    Note: you can use one or two boxes/cans of broth, depending on your desired broth/ball ratio. The amount of scallions & mushrooms would then tend to follow the broth.

    Instructions:

    1. Mix up the matzo ball ingredients and put them in the refrigerator.
    2. Cut up the scallion(s) and put them, along with the mushrooms, into the broth.
    3. Bring the broth and vegetables to a boil.
    4. Add the matzo balls to the boily broth.
    5. Lower the heat and simmer per the Manischewitz directions, about 30 minutes or so.

    Monday, August 04, 2014

    Listening Ports

    Here's a handy command to find out which ports are listening:

    /usr/sbin/lsof -P | sed -e '/(LISTEN)/ ! d; s/.* TCP .*:\([0-9][0-9]*\) .*/\1/' | sort -n | uniq

    And ymmv, but sudo is probably a good way to run that.

    Saturday, April 26, 2014

    Emacs Window Title

    One of those things I'll forget if I don't write it down - how to change the title of an Emacs window.

    M-x set-frame-name

    th! Stack Overflow

    Wednesday, April 23, 2014

    New cron job

    Welcome to my crontab, new cron job!

    18 * * * * ps -feww | grep -v grep | grep python | wc -l | sed -e '/^[0-4]$/ d; s/$/ pythons are running/g'

    Why? If you've ever run into the problem where python cron jobs start piling up because of abrtd, and you've restarted abrtd, this will help you keep an eye on things. Every hour on the 18 (so as not to run into one of my running python scripts) I'm counting python processes and if there are more than four, I'll hear about it.

    Friday, January 31, 2014

    Pet Peeve: "infinite number of"

    Welcome to my long list of pet peeves, "infinite number of"!!

    Why say "infinite number of monkeys" when you can just say "infinite monkeys"??

    Tuesday, January 28, 2014

    Solaris TAR with Excluded Directories

    It's been a long time since I had to use Solaris, and tar is bad enough without the differences between Linux and my previously favorite Unix!

    $ tar cfX - /tmp/excludes . | gzip > ~/excluded.tgz

    where /tmp/excludes looks like this:

    ./sub1
    ./sub2
    ./sub3

    So it's not just a list of what's excluded, it's starting with the dot!

    hattip: thank you, My Couple Of Cents!!

    Saturday, November 02, 2013

    Android SQLite queries and numeric predicates

    The typical code for making an Android SQLite query goes something like this:

    Uri uri = MyProvider.URI;
    String[] projection = ...;
    String where = COLUMN_NAME + "=?";
    String[] whereArgs = new String[] { someValue };
    String sortOrder = SORT_COL + " " + sortDir;
    Cursor c = getContentResolver().query(uri, projection, 
      where, whereArgs, sortOrder);

    But what if someValue isn't a String? What if you want to query your database on a numeric column? I was bashing my head against this and getting wrong results until I stumbled onto the suggestion that the "?" argument needs to be converted to a number. How to do it? Just add zero.

    long someValue = ...;
    Uri uri = MyProvider.URI;
    String[] projection = ...;
    String where = COLUMN_NAME + "=(?+0)";
    String[] whereArgs = new String[] { Long.toString(someValue) };
    String sortOrder = SORT_COL + " " + sortDir;
    Cursor c = getContentResolver().query(uri, projection, 
      where, whereArgs, sortOrder);

    You have to pass your selection arguments as an array of strings, so you'll use toString for that. But the query itself can use an addition operation to convert the string argument to a number. See the "+0" in the where string? That's it.

    Maybe there's another, even better way, but this solved my problem - my queries now return just what they're supposed to. All you need is plus.

    Tuesday, October 22, 2013

    World Series Match-Ups

    How many times have the Red Sox and Cardinals played each other in the World Series? This is the fourth time. The others were in 1946, 1967 and 2004. I was alive for two of those - can you guess which ones?

    In case you're wondering about other match-ups, here is the complete list of which teams have played each other how many times.

    11 Dodgers & Yankees
     7 Giants & Yankees
     5 Cardinals & Yankees
     4 Athletics & Giants
     4 Braves & Yankees
     4 Cubs & Tigers
     3 Cardinals & Red Sox
     3 Cardinals & Tigers
     3 Reds & Yankees
     2 Athletics & Cardinals
     2 Athletics & Cubs
     2 Athletics & Dodgers
     2 Athletics & Reds
     2 Braves & Indians
     2 Cubs & Yankees
     2 Giants & Senators
     2 Orioles & Pirates
     2 Phillies & Yankees
     2 Pirates & Yankees
     1 Americans & Pirates
     1 Angels & Giants
     1 Astros & White Sox
     1 Athletics & Braves
     1 Athletics & Mets
     1 Blue Jays & Braves
     1 Blue Jays & Phillies
     1 Braves & Twins
     1 Brewers & Cardinals
     1 Browns & Cardinals
     1 Cardinals & Rangers
     1 Cardinals & Royals
     1 Cardinals & Twins
     1 Cubs & Red Sox
     1 Cubs & White Sox
     1 Diamondbacks & Yankees
     1 Dodgers & Orioles
     1 Dodgers & Twins
     1 Dodgers & White Sox
     1 Giants & Indians
     1 Giants & Rangers
     1 Giants & Red Sox
     1 Giants & Tigers
     1 Giants & White Sox
     1 Indians & Marlins
     1 Indians & Robins
     1 Marlins & Yankees
     1 Mets & Orioles
     1 Mets & Red Sox
     1 Mets & Yankees
     1 Orioles & Phillies
     1 Orioles & Reds
     1 Padres & Tigers
     1 Padres & Yankees
     1 Phillies & Rays
     1 Phillies & Red Sox
     1 Phillies & Royals
     1 Pirates & Senators
     1 Pirates & Tigers
     1 Red Sox & Reds
     1 Red Sox & Robins
     1 Red Sox & Rockies
     1 Reds & Tigers
     1 Reds & White Sox

    Source: Wikipedia, of course! ðŸ˜ƒ

    Wednesday, August 07, 2013

    MySQL Reference

    Doing some MySQL work over the past couple of days, I googled a couple topics I needed help with, and both times I ended up at the same place.

    So thanks, nixCraft, for the assist!!

    Tuesday, July 02, 2013

    Upgrading Debian

    Upgrading from Squeeze to Wheezy

    Why? Why not!!

    Actually, it's because of the whole google-chrome-stable and gconf-blah-blah business. It's scrolled off my screen, but it's all over the internets.

    Mainly I'm following the steps I found here at HowtoForge.

    Updated my sources.list, just replacing squeeze with wheezy

    Did an update and an upgrade, started to do a dist-upgrade, but got this error:

    E: Could not perform immediate configuration on 'openjdk-6-jre'. Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)

    Did this to continue:

    sudo apt-get remove default-jre
    sudo apt-get remove openjdk-6-jre

    Now it's running... we'll see what happens next!

    How about being WAN'd in via SSH and my end goes sleepy or wonky? Yikes!! But I did a:

    sudo dpkg --configure -a

    and the dist-upgrade is chugging along again.

    A word of advice to whoever is responsible for configuration files: It sure would be nice if I could resolve all of the config conflicts either before or after the upgrade. Having the upgrade pause for me to Z and cp and blah blah blah, that's annoying.

    And it's done. Now to fix the above:

    sudo apt-get install default-jre
    sudo apt-get install google-chrome-stable



    Ta-da! It works! Even Chrome is back!!

    Friday, June 21, 2013

    Starting Oracle

    This is what happens when I don't write stuff down. Fortunately I was able to piece together what I needed to remember when starting up my database after a reboot. And now I'm writing it down!

    $ cd install-area/oracle11/software
    $ setenv ORACLE_HOME `pwd`

    $ setenv ORACLE_SID orcl

    $ ./bin/sqlplus 'sys/password as sysdba'

    SQL*Plus: Release 11.2.0.3.0 Production on Fri Jun 21 06:35:36 2013

    Copyright (c) 1982, 2011, Oracle.  All rights reserved.

    Connected to an idle instance.

    SQL> startup
    .
    .
    .

    $ ./bin/lsnrctl start

    Filed under note-to-self and let's hope next time I remember there is a note!


    Monday, March 18, 2013

    Debian Console Mode?

    I got myself stuck in VNC full-screen mode and like any good monkey just started pressing random key combinations. And I actually stumbled onto something magical and useful!

    Sunday, March 17, 2013

    Debian Wireless (solved)

    I was struggling quite a bit with the Wi-Fi on the TiBook. Then for some reason I rebuilt Debian and had a chance to start over.

    Sunday, March 10, 2013

    My Apache setup

    What, no notes to self about my previous Apache installation? Well how about I do that this time...

    Friday, March 08, 2013

    Debian on the TiBook!

    I've got Debian on my TiBook!!

    Tuesday, March 05, 2013

    Firefox already running? Not.

    Dear Me,

    Next time Firefox won't start and complains of "Firefox is already running but is not responding..."

    Sunday, February 24, 2013

    I have a new favorite OS!

    I have a new favorite OS - spoiler alert, it's Debian!

    Friday, February 08, 2013

    Where the streets have node names

    Have you ever googled your email address? If you do, you'll find all kinds of things you've posted on the internets. And for once I'm not using that word sarcastically!

    Thursday, January 03, 2013

    Samsung 923NW Screws

    Got a Samsung 923NW? Did you take the stand off and lose the screws? And now you want them back?

    Monday, December 10, 2012

    TightVNC selection sharing

    With RealVNC you use vncconfig, but according to this post by a guy named Thomas, this is what you'll put in your xstartup for tightvnc:

    autocutsel -s PRIMARY -fork

    Thanks, Thomas from the Internets!

    Reverting iTunes to 10.6.3 -- yes, you can!!

    Do you hate iTunes 11 as much as I do? Are you so angry with Apple that you're ready to throw your Mac through a window? Please, open the window first and make sure there is nobody on the ground below.

    OR... (better yet, DON'T INSTALL ITUNES 11!! -- I hope somebody reads this before it's too late)

    Sunday, December 09, 2012

    VNC keymap swap

    Ahhhhhhhhhh! (that's the choir of angels sound)

    I switched to tightvncserver hoping that my vnc crashing will go away ::fingers crossed::

    Saturday, December 08, 2012

    MySQLdb ≠ autocommit

    Something else I've learned recently is that MySQLdb disables autocommit.

    Permission and PSP Import

    If you have a PSP page and you're trying to import a custom module and you get an error like this:

    ImportError: No module named mymodule

    Wednesday, December 05, 2012

    Getting older sucks!!


    ;;(mouse-set-font "-misc-fixed-medium-r-normal--13-*-*-*-c-70-iso8859-1" "7x13")
    (mouse-set-font "-misc-fixed-medium-r-normal--15-*-*-*-c-90-iso8859-1" "9x15")

    Saturday, November 10, 2012

    Trot Diamond, 2005-2012

    Trot has gone to herd the chickens in heaven. He was born with fifteen years of love inside him, but used them up in only seven. 

    Saturday, October 06, 2012

    113 hours

    I just finished with a project I've had on my list for the longest time. I watched all seven seasons of The West Wing, my favorite TV show of all time. It only took me 40 days to watch 154 episodes, about 113 hours running time. And no, I have no idea how I managed that!

    Wednesday, October 03, 2012

    Android Calendar tip

    I stumbled onto a useful feature in the Android Calendar this morning.

    I'd been trying without any luck to find a way to make Agenda the default tab. I'd long given up wondering why the Week view wasn't available anymore.

    Then mostly out of frustration, I long-pressed the Agenda icon and all of a sudden I was looking at this screen:



    So it turns out you can choose which Calendar views to choose from and which order they appear in at the bottom of the Calendar screen. Yay!

    Saturday, September 29, 2012

    Ubuntu notes

    Some Ubuntu notes-to-self, because I'm running over VNC and don't have the whole start menu thing going on...
    File Manager $ nautilus
    Terminal $ gnome-terminal
    System Settings $ gnome-control-center
    Update Manager $ sudo update-manager
    Backup deja-dup (ui?)
    $ wmctrl

    Wednesday, September 05, 2012

    VNC tip

    I was connected to one of my VNC servers with Chicken and I don't know why, but all of a sudden I got an error, was disconnected from the server, and wasn't able to reconnect...

    Unknown message type 5

    The google wasn't much help, so I just tried stabbing at it, and luckily, it didn't take long for something to happen.

    Turns out that if went to the Connection Profiles and UN-checked ZRLE, I was able to reconnect again.

    Nope, it's happening again.  :-(

    But fortunately, Mac OS's built-in Screen Sharing does seem to work just fine. :-)

    Useful ssh tricks

    Here are a couple useful things I found recently: Corkscrew, for ssh-ing out of a firewall Using ssh -L to set up a port you can VNC through

    Thursday, August 16, 2012

    Rezound ICS Linking Fixed!!

    After the recent over-the-air upgrade of my HTC Rezound to Ice Cream Sandwich, I found that an important feature of Android (and indeed of every operating system) no longer worked: clicking links no longer launched the application responsible for handling that type of link.

    I found the problem written up on Talk Android and realized I had a couple of choices:

    1. I could restore my Rezound back to Gingerbread (Oh no you can't)
    2. I could root my phone and make the fix.

    As technical as I am, rooting is still kind of scary/daunting. I was really wishing I could go back to Gingerbread. But the Ice Cream Sandwich is so tasty! So root it would be.

    My first search led me to an extremely helpful guide on Android Forums. I followed the instructions there for unlocking my bootloaded using htcdev, a tool that HTC provided. One thing I should say here is when the instructions call for using adb on the PC, you want your phone to be up and running and plugged into your PC. If you're using fastboot on the PC, your phone will want to be in the fastboot state, which, as much as it should have been obvious to me, wasn't at first.

    Then I installed Amon Ra as my recovery, and I'm linking to it because that's proper, but you really should go to Android Forums and read up on all of this.

    And next, to be honest, I wasn't quite sure what to do. I was under the FALSE impression that you needed to flash a ROM to be root. Don't know why I thought that, but it's not the case.

    But where I ended up at this point was really great, the All-In-One Tool. It would have done the bootloader unlocking for me if I hadn't done that already. It also does five flavors of recovery flashing, which I wasn't needing at that point. What I did need, though, was Super User. And the instructions were muddy clear, so let me add some advice about that. You want to run the Perm Root (GB/ICS) command while the phone is plain old up and running, since adb is used to push a zip file, SuperSU.zip. It's after that file has been pushed that you want to reboot into recovery and use that recovery's zip installer. The output of the Perm Root command tends to give the impression that you're already rooted, but that's not the case until you've used recovery to do the installation of the zip.

    So now I was rooted, but I wasn't done. I had copied /system/build.prop to my desktop, made the necessary edits* and pushed it back to my phone as /sdcard/build.prop.new, but I needed to put it back into /system. To do this, I used Mount /system (rw / ro) to make /system writable and I used Root Explorer (File Manager) to move build.prop.new to /system, rename build.prop to build.prop.old and finally rename build.prop.new to build.prop.

    *Oh, and by the way, I found "ro.da1.enable" in build.prop twice, so I just made all of the changes twice.

    Once I rebooted my phone, the good old linking behavior was fixed. Just as for centuries, clicking a Microsoft Word Document link on my desktop browser has always launched Microsoft Word, clicking on an Amazon MP3 link now launches the Amazon MP3 app, just as the gods intended.

    Now that I'm able to declare victory, thanks to lots of help from the Internets, I'm off to click some thank-you and donation buttons.

    Saturday, August 11, 2012

    Screen capture!

    My HTC Rezound has been upgraded (ha!!) to Ice Cream Sandwich, and I wondered whether screen shots might be possible. It is!! Just power/vol- and voila!!


    Monday, April 16, 2012

    Emacs Colors Begone

    Thanks to Bjørn Hansen, I now know how to rid my Emacs of the annoying syntax coloring!

    (setq-default global-font-lock-mode nil)

    I'm not sure what version of Emacs that was for, but here's what I had to do (a couple times, actually) in version 23.1.1...

    M-x global-font-lock-mode

    Monday, April 09, 2012

    Database Dropped

    If you're like me, you will someday experience that terrifying, dreadful feeling upon reading these words on your phpMyAdmin screen...

    Wednesday, March 07, 2012

    Fun with words

    What do each of the following have in common?

    • something
    • tenletters
    • eighteencharacters
    • two words

    Sunday, March 04, 2012

    layout.xml -> Activity.java

    I made a bunch of changes to a layout file this morning and wished I had a quick way to get all of those elements into my java code so I could make it go. So I popped into Emacs and wrote a little function to do it! And here it is. Enjoy!
    (defun xml-to-java ()
      (interactive)
      (progn
        (setq tmp (buffer-string))
        (switch-to-buffer "tmp")
        (insert tmp)
        (goto-char (point-min))
        (save-excursion
          (replace-regexp "[\n\t ]+" " ")
          )
        (save-excursion
          (replace-regexp
           " *<\\(\\w+\\)[^>]*android:id=\"@\\+id/\\(\\w+\\)\"[^>]*>"
           "\nprivate \\1 \\2;\n\\2 = (\\1) findViewById(R.id.\\2);\n")
          )
        (save-excursion
          (replace-regexp " *<!-- \\([^>]*\\) -->" "\n/* \\1 */\n")
          )
        (save-excursion
          (replace-regexp " *<[^>]*>" "")
          )
        (save-excursion
          (replace-string "\n\n" "\n")
          )
        )
      )

    Thursday, February 23, 2012

    Facebook Subscriptions

    Here's another link I can never find when I need it... maybe you need it to!

    Facebook Subscriptions

    Very handy if you want to unsubscribe from annoying f-book friends.

    Hat tip: Quora

    Thursday, February 16, 2012

    Google Calendar v3 Entry Update

    Here's something that would make a nice addition to the Google Calendar Developer's Guide (v3)...

    I've been trying to update an event and all I've been getting back is a cryptic 400 error, "unsupported output format" -- BIG HELP!!

    Well maybe if it had said input format... I don't know what made me try this, but when I set the Content-Type header of my PUT request (application/json) -- IT WORKS!!

    Saturday, January 28, 2012

    HTTP Clients for Android

    Android Developers Blog: Android’s HTTP Clients

    I read the above post back in the fall and thought, "yeah yeah, I'm using HttpURLConnection, so need to think about this at all."

    Well this week I found some odd, frustrating behavior and decided to try the Apache HTTP Client to see if it gave different results. And oh boy, does it -- it always just works!

    OP Jesse says Apache has "fewer bugs" on Froyo, which is my target release. I guess I should have switched sooner. But now I have!

    Sunday, January 22, 2012

    Android Emulator | Android Developers

    I can never find this when I need it, i.e. when I forget which keys simulate the menu and search buttons. Note to self, they're F2 and F5.

    Android Emulator | Android Developers

    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!!