Hacking

When Will eBook Readers Stop Sucking?

I’m starting to get interested in eBook readers, ones that use E Ink technology. I have a handful of books (technical books, not fiction) that I’d like to slog through to brush up on some rather boring topics, but reading them on a backlit screen is giving me headaches.

Amazon’s Kindle 2 has lost the delorian-inspired styling of its predecessor, but it does about a dozen things that I don’t want. First, the QWERTY keyboard takes up entirely too much real estate for something I don’t need. I already have a laptop, a netbook, and a smartphone, I don’t need to browse the web on my ebook reader. I also don’t need it to read to me, I don’t imagine that code samples read aloud are particularly useful. And I really don’t need Amazon’s DRM.

The Sony 505 looks a little more rational, with a better size-to-screen ratio, but at $300 it’s still more than I want to spend on a gadget which will be laughably obsolete in 6 months.

A seemingly unknown company makes the COOL-ER reader, which comes in a candy assortment of colors. Despite the stupid name, which is difficult to search for on many sites thanks to the dash, it seems to have a more reasonable take on eBook readers. It’s light, it doesn’t bother with a keyboard or wifi, it stole its styling directly from the iPod Mini, and it’s almost reasonably priced ($250). But reviews indicate that it has cheap construction and a painful UI, and it just doesn’t seem to stack up when the Sony 505 is only $50 more.

I’m waiting for the “perfect” ebook reader to come out, one without a ton of bells and whistles at a low price. It’s probably good there isn’t one right now since I already have a ton of gadgets and not a ton of extra cash to spend on things that fall farther towards “want” than “need.” So for the time being I’ll put the fun money I might have spent on an ebook reader towards a vacation with Chris this summer and wait for someone to come out with an ebook reader I actually want to purchase.

Programming

Android: Hello Circle

Note: This article is really old. It is here for posterity only. You should really find a more current tutorial.

I’ve been a little frustrated by the lack of Android tutorials. I got a Hello world going, and found that most of the few tutorials I could find were WAY more complicated than what I want to start with. GPS, map overlays, to-do lists, etc, which is great and all but I want to start simple and work up from that. So I set out to build “Hello Circle,” a program which drew a dot on the screen wherever you touched it. After about 12 hours of beating my head against Eclipse, the Android SDK, and the frequently incorrect Android documentation I got it working. So here’s a tutorial.

Setting up the environment I’m going to assume you already successfully completed the Hello World tutorial. Which means you’ve got yourself an IDE (probably Eclipse), the Android SDK, and the ADK (Android Development Kit) which is a plugin for Eclipse to help keep things in order. If  you haven’t done that yet follow these instructions and pray everything works as planned. I’ll see you in a few hours. Create a project just like you did for Hello World. Creating the ViewGroup In order for anything to display on the screen you need to create a view. In the Hello World tutorial you created a TextView. We’re going to use the XML setup for creating our view, and rather than creating a TextView we’re going to use a FrameLayout, which is acutlaly a view group. Open up /res/layout/main.xml and plop in this fine code (obliterating anything that may be there):



This, when it’s called in our code, will create a FrameLayout view with an id of “main view,” a width/height that fills the screen, and a neon green background. The hex color code for the background includes the alpha channel (the first to FFs). Setting the contentView to our XML Head over to your main class and call setContentView on your layout. Your code should look something vaguely like this:

import android.app.Activity;
import android.os.Bundle;

public class RoboTown extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
}

If you run your code at this point you should get a big green background which does nothing. Hooray! Creating the Ball class Now we want to create a circle. Actually we want to create a lot of circles. So the first step is to create a new class called Ball. Right click on your project’s main class in the Package Explorer (on the left) and click New > Class. Give it the name Ball and click Finish. Our ball is actually going to be another view. What? Yeah. It’s a view. All of our Ball views will eventually go into our FrameLayout, but we’ll worry about that later. So first, modify your Ball class so that it extends View, since it’s a new type of View, and while you’re at it go ahead and import some of the things we’ll need for drawing:

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

public class Ball extends View {

}

In order to draw a ball we need a handful of things: a Canvas to draw them on, x and y coordinates to place the center of the ball, the radius, and Paint to give it color. So we’ll start by establishing those (I hid the imports for the sake of clarity, you should leave yours there):

public class Ball extends View {
    private final float x;
    private final float y;
    private final int r;
    private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}

In the last line we create a new Paint object, creatively called mPaint. A Paint contains information like colors, text sizes, etc, which affect the appearance of the drawing. So far we haven’t assigned any of those things to the Paint, we’ve just created it. Now we need to write the Ball constructor, which is the method to be called whenever we create a new ball:

    private final int r;
    private final Paint mPaint = new    Paint(Paint.ANTI_ALIAS_FLAG);

    public Ball(Context context, float x, float y, int r) {
        super(context);
        mPaint.setColor(0xFFFF0000);
        this.x = x;
        this.y = y;
        this.r = r;
    }
}

Our constructor takes a Context, x, y, and radius r. We pass these arguments in when we instantiate the object and assign them to the object properties. And lastly, the method which actually draws the circle, onDraw:

public Ball(Context context, float x, float y, int r) {
    super(context);
    mPaint.setColor(0xFFFF0000);
    this.x = x;
    this.y = y;
    this.r = r;
}

 @Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    canvas.drawCircle(x, y, r, mPaint);
}

Ok, our Ball class is done. Save it and head back over to the main class. Drawing a Ball on the screen At this point we haven’t actually drawn anything. We’ve just created Ball which we *could* draw if we so desired. In order to draw it on the screen we first have to get a hold of our FrameLayout. Since we created it via XML we’ll need to find it again using findViewById():

  setContentView(R.layout.main);

   FrameLayout main = (FrameLayout) findViewById(R.id.main_view);

Now we can use the addView method to attach a new Ball to our main view:

    FrameLayout main = (FrameLayout) findViewById(R.id.main_view);
    main.addView(new Ball(this,50,50,25));

Run your code now and, if all goes well, you’ll have a circle with a radius of 25 pixels in the upper left corner of the screen. Yay! Take some time to play around with Paint options, positioning, etc with the various methods outlined in the documentation. Now all we have to do is add a touch listener to react when the screen is touched. Which is thankfully pretty easy. We’re going to create a new touch listener and attach it to our main view all in one fell swoop:

main.addView(new Ball(this,50,50,25));

main.setOnTouchListener(new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent e) {

    }
});

The onTouch() method is a callback function which will be hit whenever you touch the screen. Android will send it a View (v) and a MotionEvent (e). We already know what a view is, and a MotionEvent is an object containing information about the touch. All we care about are the X and Y coordinates, which are accessible via the getX() and getY() methods.

main.addView(new Ball(this,50,50,25));

main.setOnTouchListener(new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent e) {
        float x = e.getX();
	float y = e.getY();
    }
});

The last thing we have to do before we can start drawing is to cast the view we were sent as a FrameLayout, so we can use the addView() method with it. Then we can instantiate a new Ball at the coordinates sent in the Motion Event:

main.addView(new Ball(this,50,50,25));

main.setOnTouchListener(new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent e) {
        float x = e.getX();
	float y = e.getY();
        FrameLayout flView = (FrameLayout) v;
	flView.addView(new Ball(getParent(), x,y,25));
    }
});

The getParent() call sets the context for the Ball to the main Activity. I only vaguely understand why it has to be done this way. So now, the moment of truth! You should have all the code you need to run the app in your emulator or even on a real phone. Touching the screen will place a dot where you touched. Amazing! Hopefully you now have enough of an idea of how all this stuff plays together that you can forge your way to making something vaguely useful (which this isn’t).

DIY Aeroponics

Garden at Two Weeks

IMG_0248

It’s been two weeks since I planted my garden, and the basil is starting to have actual leaves!
The oregano is… well, it died. And so I planted more. It’s sprouted, and these sprouts look more lively than the previous ones. I strongly suspect that the culprit was over watering. Why do I suspect this?

IMG_0249Oh I don’t know, maybe it’s the algae that’s growing on a few of the pots. That’s right, algae. On top of my growing medium (rockwool). I’m gonna take that as a sure sign that the whole thing is just a bit too soggy. So I’ve moved the pump onto the same timer strip as the lights, meaning it will now be on for about 16 hours a day instead of 24. Hopefully this will give things enough time to dry out.

Three of the 5 lettuce pods have popped up, but they aren’t doing much, so I think they may be suffering from overwatering as well. We’ll see if a little less saturation helps them perk up.
IMG_0245

Uncategorized

Playing around with 3D modeling

mechanical_pencil

It started when The Sims 3 came out. Rather than get The Sims 3 I decided to start playing The Sims 2 again. And then of course I needed to download new objects for it. And then I wanted to get back into making my own objects.

So I spent the better half of the afternoon playing around with 3D modeling. While the modeling techinques are pretty much the same as they were when I left off (about 8 years ago), the rendering is vastly improved. With nice enough lighting and textures even simple objects can look good, and lose that excessively smooth CGI look.

screwdriverI started with a tutorial on how to make a screwdriver, and moved on to a slightly more adventurous model of the mechanical pencil I was using. I think lighting is one of the biggest things I’ve totally forgotten, setting up and aiming lights didn’t work at all how I expected. The tutorial had me use a dialectric material, which I had never heard of (not that I was ever really super into materials anyway), except unlike the tutorial all my materials came out greenish. You can see it in the screwdriver handle and the barrel of the pencil.

I don’t have any real reason to get serious about the rendering side of things, since most of my 3D modeling is for rapid prototyping a la Makerbot, but it’s fun to play with at least. And adding a Fur texture proves categorically that round + fuzzy = cute:
Fluffy

DIY Aeroponics

Garden #1 Hits Day 7

Garden #1 Day 7 My first garden, the airstone powered one, is now a week old! The basil seems to be pretty happy, all three pods sprouted (and 5 of the 6 seeds came up). I’ll thin them to one plant per pod once they get a little taller.

The oregano on the other hand is not happy. I think things are too soggy. The bottom of the rockwool is touching the water, and I think that plus the airstone is just saturating things too much. I turned the pump off for the day, and man that thing is noisy.

Garden #2 hasn’t sprouted yet, but it’s only been a few days. I figured out that a lot of the dripping water sound was coming from a loose connection to one of the spray heads, and now that it’s fixed garden #2 is actually pretty quiet. Especially compared to the air setup. I still don’t like how tall the whole thing has to be though, it looks a little silly.

The light I ordered came in on Monday. After looking around at DIY options I decided it would cost me about the same to build a much uglier adjustable height lamp, so I got this one off Amazon for $25 (free shipping!). It takes standard bulbs, unlike the other grow lights I could find, and isn’t hideously unattractive. The side flaps are a little under engineered, I had to stick something in the hinge to get them to stay up.

It casts a nice unappealing blueish tint, which is supposedly what plants like for promoting vegetable growth. I like the lamp enough that I ordered a second one for garden #2.

New Lamp

Business, Etsy

Your Own Domain + Etsy

I’m slowly purging all references to my Etsy shop from my business cards, ads, etc because I want more control over by branding. Although I don’t have any short term plans to set up my own shopping cart I want to be a little more prepared if I do decide to.

I’ve set up http://shop.everythingtiny.com as a redirect to http://kfarrell.etsy.com and thought while I was at it I would write up instructions for how other folks can to – and on the super cheap. I’ve seen a bunch of places that charge a monthly or annual fee for domain forwarding. The cost of my setup is about $10/year including domain registration.

Tools You’ll Need

  • A membership with NearlyFreeSpeech.Net. If you know a little bit about what you’re doing you can use this setup on *any* host, but for the sake of simplicity all my examples are on how to do this with NFSN.
  • An FTP or SFTP client. I like to use FileZilla.
  • A text editor. Notepad will work just fine.

If you don’t already own a domain you can buy one through NearlyFreeSpeech.Net. It’s a little less than $9/year for domain registration and unlike GoDaddy they won’t spam you into getting a zillion of their other service. Deposit $10 into your NFSN account, purchase your domain name (it pulls from your account balance), and you’re good to go.

If you already have a domain name there will be a little extra configuration for you, but we’ll get to that later.

Setting up your site

Ok, there is a tiny cost to setting up the forwarding. While NFSN doesn’t charge any monthly fees for sites, they charge for storage (how big your site is) and bandwidth (how many gigabites of files your site sends to other people). Since you’re just forwarding your visitors on to Etsy, both of these will be very very low. Extermely low. But nonetheless you’ll need to make a small deposit into your NFSN account, $1 should be plenty.

Creating your .htaccess file

A .htaccess file is a special file that tells the server how to handle requests for your site. Open up a new file in your text editor and copy/paste the following:

RedirectTemp / http://yourshop.etsy.com/

Save the file to your hard drive with the name “.htaccess”, making sure there is no file extension such as .txt.

Upload the File to Your Site

Open up your FTP client and connect to your site (the connection information can be found by logging into NFSN and clicking the ‘sites’ tab and then the name of your site.

When you connect you’ll likely see a number of folders such as “logs” “private” and “public”. Upload your .htaccess file into the public folder. If it has a file extension rename the file so it is just “.htaccess”

Add Your Domain as an Alias

To make your domain work with your site you need to add it as an alias. Go to the site information page and click “Add a New Alias” on the right. Enter the domain you wish to use. I.e. if you want “http://shop.everythingtiny.com” to go to your Etsy shop enter “shop.everythingtiny.com”.

If you purchased your domain name through NFSN you’re done! It may take 24 hours for everything to start working, so be patient if it doesn’t seem to be doing anything right away. You can test to see if your redirect is working by going to http://yoursite.nfshost.com, where yoursite is the name of the site you created.

If you purchased your domain elsewhere

You’ll need to add a record to your DNS to get things working. Check your registrar’s documentation for “how to add a DNS record.” Once you’ve figured it out, you’ll want to add what’s called a CNAME record. It will look something like:
shop CNAME yoursite.nfshost.com.

Where “shop” is the subdomain you want to use (i.e. shop.everythingtiny.com) and yoursite is the name of your site at NFSN. The CNAME record may take a few hours to take effect.

Tada!

DIY Aeroponics

Sowing Garden #2

Today I sowed the seeds in garden #2, which is the first one I started on. It uses an aquarium water pump, 1/2″ tubing, and spray nozzels.

I’m not really happy with it. I managed to order the wrong spray nozzels (again), and the ones I got spray a fine mist, but straight out instead of in a 360 degree circle. This would be great if I had a big outdoor garden, but doesn’t really work for my little planter. I also don’t like how tall the whole thing has to be for the plants to clear the spray nozzles, since the tubing sits about an inch taller than the pump, which itself is an inch and a half tall. And it’s noisy. You can hear the sound of trickling water when it’s on, although I’m hoping that will be resolved by eventually getting the correct nozzles.

Garden #2

I also realized I had a design flaw. The power cord, which is supposed to go through the small hole in the front, won’t fit. Because unlike airline tubing, which can be detached and reattached easily, the water pump power cord doesn’t come off. So it has to go through a hole big enough for the 3 prong plug to fit in. Unfortunately the only hole big enough was one of the plant holes, so until I order more acrylic to cut a new top it’s just a 5 plant unit.

Overall I’m feeling a little cranky about this planter. I think this design would be well suited for something larger. Home Depot had some fun looking 12″ diameter plastic planters, and if I had anything resembling a basement I’d build something nice and big and grow tomatos in it. But I don’t, and this design just isn’t working so great on a smaller scale.
Garden #2
On the plus side I cut black caps to replace the felt ones I was using before and etched the plant names into them. And they look pretty sweet. They give the whole thing a sweet sci-fi look. I stuffed a plastic bag into the open holes (one for adding water, one which is the failed power cord hole, and one which is a plant hole with a power cord sticking out). It’s very technical.

It’ll probably be a week or two before I get more acrylic in, so this one will have do until then. I’m holding off on ordering different spray heads until I get a better feel for exactly what I need, because it’s annoying to spend more on shipping then you do the actual item.

Over at planter #1, things are starting to grow. One very eager basil seed is starting to sprout, and another one looks like it may come up tomorrow. The oregano is still in hiding, probably won’t see that until next week.
A sprout is sprouting!

Exercise

100 Push Ups

Now that I’ve ditched 10 pounds of excess flab I’m more interested in building up some strength than weight loss. Sure, I still have another 5 pounds to go to reach my goal, but focusing on my weekly weight loss is frankly a little boring now that my pants fit again. I’m still losing weight, but more slowly than before, and I’m OK with that.

Embarrassingly enough, I cannot do a single pull up. In fact, I don’t think I have ever done a single pull up in my life. In elementary school we had to do the President’s Challenge, specifically the Physical Fitness Test, and I always opted for the “flexed arm hang” instead of an actual pull up. That combined with my unwililngness to do the one mile run meant I never got the Presidents’ Award. Oh well.

So clearly my upper body strength is a little lacking. While I’m not quite ready to head over to the park every day to practice my pull ups, I can do some push ups.

Last week I started doing the One Hundred Push Ups program. In my initial test I could do 2 consecutive push ups.  In theory over the next 6 weeks or so I will build up enough strength to do 100 consecutive push ups. The program has you doing 5 or so sets of push ups 3 times a week, slowly building up the number you do at a time. There’s a similar program for squats, but those I actually have pretty well under control.

I’m now up to being able to do 10 consecutive push ups, and that was after doing 4 sets of 3-5 push ups, so things seem to be progressing pretty quickly. This in combination with continuing the EA Sports Active 30-Day Challenge (which I have been totally slacking on – but getting exercise in other ways)  should turn me into a super buff fitness freak. Or at least make me less pitifully weak. We’ll see.

DIY Aeroponics

First Planting!

I’m still waiting for some parts to come in for the garden I was working on in my last post. But in my research I found another, much simpler way to set up an aeroponic garden. Since I already had most of the necessary parts, I decided to try it out.

caps!

Rather than use a water pump and sprayers to mist water around, this setup uses an air pump (outside the water chamber) and an airstone in shallow water. Airstones and pumps can be found at any aquarium store.  I got a $10 pump (anything suitable for 10 gallons will be fine) and I had this airstone lying around. They’re about $5 new.

Lid out I’m using a tupperware container for a vessel, with a laser cut top and seed pods. I wish I hadn’t been totally sleep deprived and forgotten to photograph them, the seed pods are pretty neat. They’re made from 3 pieces of acrylic plastic, held together by gravity, and hold a plug of rockwool nicely. I’ll need to make some for the water pump version of the garden, and will be sure to get a good shot then. You can sort of see the bottoms of them, hanging from the blue top. Plans for the top and seed pods are both up on Thingiverse.

A quick note about working with rockwoool – it’s kind of like fiberglass, so you need to wear a mask when you’re working with it dry. Depending on how sensitive your skin is you may also want to wear latex gloves. It needs to be soaked for 24 hours before use, for pH reasons I only vaguely understand. I did not soak mine, because I did not read that until after I had already painstakingly embedded seeds into the plugs. By the way, oregano seeds are very hard to pick up one at a time with tweezers.

Rockwool soakingHere’s a shot of a seed pod, it rests in the hole in the top. Each seed pod needs some sort of opaque collar to keep excess light from getting into the root chamber. I used felt because it’s easy to cut and I had some on hand, but I plan on making acrylic plastic collars for them with the name of the herb engraved. The collars stay on even after the plant has sprouted. The plastic domes on the other hand are temporary, and just there to keep all the water from escaping before the seeds germinate. Once things pop up I’ll take them off.

The total cost for this setup, not including lighting, was about $30, although if you don’t have access to a laser cutter it would be a little more to have them cut by a service like Ponoko. You could also just buy the AeroGarden seed kits, which are about $20 and include 6 plastic pods, and use your tupperware container’s original lid by just drilling a bunch of holes in it. But I have a laser cutter, so I wanted to get fancy.

We’ll see in a few things whether this thing actually grows anything. I’m slightly dubious. It’s also hella ugly. Partly because of the little domes (which will hopefully be off in a few days)  and partly because of the black plastic bag I’m using to keep light out of my otherwise clear tupperware bin. I’m debating between making a nice fabric enclosure for it and just grabbing a can of rustoleum and spraying the outside. Maybe I’ll do both.

DIY Aeroponics

Gardening Gets Underway

Today I started collecting things for my DIY Aerogarden, and testing out spray set ups. Here’s what I found:

Aquarium Pump106 GPH pump

I started my search at a local aquarium store, New World Aquarium at 38th and 3rd. It cost a little more than it would have online, but the salesperson actually knew things about it and could answer questions, so it was worth it.  It’s about two inches tall and has variable output between around 45 and 106 GPH. It seems to push water through the tubing/misters nicely.

Bits of tubing Various hose bits

I stopped at the local hydroponics store to get some T joints for my hosing, and some sprayers as well. The sprayers attach to 1/2 hose pretty easily, just cut a small hole in the hose and push the sprayers in.

Food! I also picked up some rockwool and plant nutrients, so make my own “seed pods.” The bag of nutrients was $18 for more than 2 pounds of dry mix, which gets mixed with water at about 1 tsp per gallon. My garden will probably hold about a quart. So it should last me quite a while. The rockwool is $7.50/48 cubes, and I’d need a max of 1 cube per planting (tho I plan on using half, they’re big cubes).

Hosing with misters

Hosing with spray barbs I ended up using a circle of 1/2″ hosing about 6″ in diameter. The four misters are placed relatively evenly around it. The bottom of the T joint goes to the pump.

The misters I got are a little more like sprayers than misters, the water coming out isn’t very fine. I’m not sure if this is a function of water pressure or the type of misters I got, I think the latter.

I ordered some different misters from Drip Depot which are supposed to produce a “very fine mist” so we’ll see what difference that makes. Luckily all this stuff is really cheap, the hosing I can get at the pet store down the street, and the misters/connectors are all under a dollar each.

Pump in vase Here’s my pump/hose setup in the planter I got from the dollar store. There are two problems. One, it’s not tall enough. The planter has these “feet” which make it look taller than it actually is. I want at least 2″ from the top of the sprayers to the top of the bucket. The hose connectors add a substantial amount of height to the whole thing.

I ordered some L connectors which would allow me to put the pump on its side, but I think that would give me an extra 1/2″ at best.

But the real problem with this planter is that it leaks. Sure, it *looks* sturdy and without holes, but there are thin spots in the plastic near the bottom where water started eeking out. No good.

So tomorrow I’ll go in search of a more appropriately sized leak proof bucket. Once I have that I can start working on the top part to hold the plants and deal with lighting.