Satya's blog - 2009/02/

Feb 02 2009 18:26 Charleston County Recycling news

I received the Charleston County recycling newsletter last week, and it brought up some questions. I emailed them and they answered -- every single question was answered, in full, in a reasonable manner. Now that's service.

First, plastic window envelopes. You can rip out the plastic and recycle the paper parts. Yay!

Then, paper with confidential information: You can shred and drop off the shredded paper at a drop-site.

So yeah, as long as the contamination is kept to a minimum, they'll accept paper in any form.

#1 and #2 plastics are only taken in bottle form because that's what the vendors want. Oh, and they don't take recyclables #3-#7 because there isn't a market for it. Shipping it elsewhere would just raise our taxes, and we won't stand for that, right?

Last updated: Feb 04 2009 06:57

Tag: hippie

Feb 09 2009 17:13 Did I go to Wando?

A 10-second-long transaction at the bank, and the girl at the counter asks me, did I go to Wando (high school)? No? A brother? Any family member? Which is weird, because I'm not from around here! (And it's fairly obvious.)

I've had a lot of strange questions, but that's a first.

Tag: weird

Feb 14 2009 10:14 To-do lists and food plans

Based on some stuff I posted on identi.ca, and that JaredW. Smith also posted, here are a couple of lifehacks.

(Lifehack: an adjustment to your habit that makes life easier.)

I maintain a spreadsheet with a daily plan of what I'm going to have for lunch and dinner. It's not in any great detail, just two entries every day, for about a week in advance, each entry being something like "pasta" or "KCJI" or "leftover chinese". That helps me plan what to buy, keeps me from too quickly repeating, lets me track where I ate and when, and helps prevent situations where various different leftovers are piling up in the fridge. This plan should be flexible, though, so you can switch stuff around based on immediate needs and wants.

I have a TODO list on my desktop. A program called tomboy, which is available in at least Debian and Ubuntu, lets me put short sticky-notes style windows on my desktop. Tomboy is actually a personal desktop wiki, and there are other sticky note programs out there. A simple text file may work better for some.

The key is, to-do list should contain items to do *today*, and other immediate stuff. Otheriwse stuff just stays on it forever. "Exercise" isn't a TODO list item. "laundry", "treadmill", "clean oven" are TODO list items. Those are the "things I need to do today". Sure, you can also have things like "fix that bug in that program", but if you don't get to it soon, remove it from this list. And yes, you can use a personal bug-tracking system for this, as well.

Feb 18 2009 21:18 Craigslist scams with a laptop

I recently posted a laptop for sale on craigslist. I got several responses right away, but none of the ones I contacted got back to me. Here are some of the responses. I most cases I answered the questions asked or asked them when they'd like to come look at it. The more scammy-sounding ones:

Do you still have these item for sale please let me know? thanks
Hello Seller is this item available if so i will like to know the condition and i am willing to pay u by Pay Pal i will be waiting to hear from u as soon as possible

I also got one offer for half the price I listed, and a couple of emails asking me to call a (local) phone number. These were legitimate, I think. Lots of them asked if it was still available (and nothing else). A couple wanted to know about battery life and the OS. All of them got answers.

Another asked for a couple of details and did reply to me when I responded, though they declined to buy. I thanked them for at least having the courtesy to communicate properly. Oh, here's a beauty:

Thanks for your reply and am glad to know that it is still available for sale.However i have some few questions on the products your selling.
1,I would like to know the reason you are selling it..?
2,What is the current condition of the item..?
3,How much would you take last for it, though am okay with the listed price..?
4,Do you have the original box for it and the receipt..?
5,Would you please allow me to pay through paypal even though i would cover the shipping because am currently not local at the moment,Am participating in a research project and i would like to purchase this item from you on behalf of my colleague whose computer crashed.

If you do not have a PayPal account, you can do so by going to www.PayPal.com and set up your account it is free,easy and guarantees transaction safety.Once you send me your paypal email account, I will send you the payment for your item as well as $100 USD to cover shipping vai USPS EXPRESS MAIL INTL.
I would be glad if my request is favorably consider.
Thanks

Shipping? *International*? No thanks. Here's another one that at first just asked if I have it, and after I said yes, came back with this:

Nice hearing back from you, I would be happy to purchase it from you. I'm shipping this international to my friend, and I think it would be less costly if we could ship it straight from you to him. I'm ready to pay you the total amount of $250,for the item and $100 the shipping fees ,via USPS EXPRESS MAIL INTERNATIONAL (EMS) and i will pay you via paypal if that would be acceptable. Please reply and include your paypal email address if you are interested. Thank you and God Bless you.....

The "total amount" of $250 is wrong, it's more than what I had posted. That's in addition to the other things wrong with this message.

A few days later I re-posted the laptop. This time I said explicitly that I want cash, and local pickup, and no exceptions. Almost immediately I got a couple of emails asking if I still had it. Then I got this gem:

I am very glad to hear back from you. I am a University Senior lecturer residing in [New York]. I came across this ad on Craigslist and thinking of my Son's Birthday coming up soon, I would love to get an awesome present for him, which he really wants, he was currently transferred from USA to West Africa with his team on a research on Human development under world Health Organization.I'll be paying you through PayPal,it's secure and protects two parties in a transaction. I will forward my son's residential address to you for shipping as soon as the payment reaches you. Please kindly get back to me ASAP,so that i can make the payment there.
NB: I will be paying you $200 for item and i will include $100 to cover up the cost price for the shipping fee. Get back to me with your PayPal email asap.

Regard,

Sent from my iPhone

And then this one. I never mentioned anything about being "loaded":

INTERESTED IN YOUR DELL LAPTOP. WHAT DO YOU MEAN EXACTLY LOADED?? REASON FOR SELLING?? ANYTHING WRONG?? SLOW??

And this one:

I am [name deleted] by name and will like to buy your item as a birthday gift which will be commencing very soon and will like to buy it which i will highly elated want you to help me to ship it to her directly over there which i will be responsible for the shipping cost via Usps Expres mail service,so i will be glad to pay you securely via Paypal or via Cash money order which will be deliver to your at your doorstep in cash,so i will be offering you $350 for it including the shipping cost via Usps express mail as mentioned above and if this is okay by you,you can send me your paypal email address with your full name as appear on your account and if you feel you prefer cash money order for immediate delivery...you can mail me the details below...

Your full name:
Your home address as you will like to be the receiver...
Hope to hear back from you soon.
God Bless.....

Okay, dude. I am not going to ship this laptop anywhere, especially not when you're offering me such juicy bait: nearly double the price I quoted.

I eventually got a couple of responses that were local, and sold it to the first one I got.

Tag: scam

Feb 21 2009 18:15 Making PDFs with JasperReports and Rails 1

Here's part 1 of how to produce a nice PDF in a Ruby on Rails application using JasperReports, a Java code library.

Overview:

The development:

  • Set up your Rails application to produce XML for the data to be filled into the template.
  • Make the PDF template using iReport. iReport produces a .jasper file.

The execution:

  • Your Rails application produces XML.
  • A small Java program puts the XML and the template together using the JasperReports libraries. It returns the PDF.
  • Your Rails application accepts the PDF and stores or serves it.

Setting up the template and building the XML should usually be done at the same time. Since I'm not doing a full tutorial on JasprReports, I'll cover things briefly and without screenshots. I'll mostly cover the stuff that's specific to using an XML data source.

First, get your Rails app to somehow return an XML file. Stick a method in the model to build the xml, call the method something like build_xml(). This will take a list of ids of the records that you want in the PDF. I give it a list of ids or an array of grade report data structures because I usually produce a grade report for a given student. By giving this method multiple student ids or data structures, I can produce a whole set of reports in a single PDF file.

By giving it an array of data, each element being one student's grade data, the caller is agreeing to fetch the data from the database. By giving it ids, the builder methods will fetch the data as well as building XML. I do something like this: I put a method in Student class to get the data, and I call that method, and send what it returns to build_xml.

def self.build_xml(grades)
    buffer=""
    xm=Builder::XmlMarkup.new()
    xm.instruct! 
    buffer += xm.grades do
        grades.each do |c|
            build_single_xml(xm, c)
        end
    end
    return buffer
end

build_xml declares a buffer where the XML data will accumulate. xm is the builder object. instruct! puts in the declaration that this is an XML document. xm.grades produces a "grades" XML element, and the block inside it produces the contents of that element. We loop over the array of "grades", calling build_single_xml for each. build_single_xml builds each student's grade report data. So, our XML is going to look like:

<grades>
    <student id="">
        ...data...
    </student>
    ...repeat for each student...
</grades>

Notice that each student's id is included as an attribute.

I won't cover how to generate all the XML at this point. Let's turn to the JasperReports template... in part2.

Tag: geeky rails howto

Feb 24 2009 18:53 Pro tip: fatherly advice

My father gave me two pieces of advice, and one skill:

  • Always be presentable,
  • Use the right tool for the job, and
  • Riding a bicycle

Always be presentable

He really meant, "Shave!", but it also applies to general appearance: you never know what kind of opportunities will present themselves when you're wearing ratty shorts and a torn-up shirt. He didn't mean wander around with a suit and tie at all times, of course. This comes in useful, in the literal sense, when you suddenly get a meeting scheduled and... oh, good, you've shaved today!

Use the right tool for the job

Literally, he meant don't use a flat-blade screwdriver for turning a Philips-head screw, but he also meant in general. You can't approach a problem with a mind-set that doesn't fit a problem. I've been struggling with a particular construction problem, that I just fixed (or vastly simplified, we'll find out after the... stuff... dries) by going out and getting the right $5 tool.

Riding a bicycle

He forced me to learn to ride a bicycle, which became my primary transport for years in college and the first few years of work. Everyone should learn to ride a bicycle, and swim. Then you can compete in triathlons (he doesn't say that, I'm saying that). Yeah, no deeper lesson here, except: learn to ride.

The examples I use are literal, because those are the contexts we encontered them in. He's a technical/mechanical person, an electronics guy, so that's what we usually talk about. Soldering, hanging drywall, and stuff. Except we didn't have drywall.

Tag: tip