An update to the bash script that takes a parameter:

#!/bin/bash

book=$1

[[ -z $book ]] && { echo “No argument supplied, exiting!”; exit 1; }

[[ ! -e $book ]] && { echo “Can’t find a file with the name $book, exiting”; exit 1; }

title=${book%.*}
bookcounter=0
linecounter=0
sed -i ‘s/\r$//’ “$book”
while read line
do
((linecounter+=1))
if [[ $linecounter -gt 300 && -z "$line" || -z "$output_file" ]]; then
linecounter=0
((bookcounter+=1))
formatted_bookcounter=$(printf “%03d” $bookcounter)
output_file=”${title}${formatted_bookcounter}.txt”
echo “…starting segment $output_file”
echo “$title – segment $formatted_bookcounter” > $output_file
echo “===================” >> $output_file
echo “” >> $output_file
fi
echo “$line” >> $output_file
done < “$book”

Bookmark and Share
31
Aug
2010

Why are we always trying to copy Windows?

There are skins for each of the OSs that aren’t Windows–to make them LOOK like Windows.

http://linux.slashdot.org/story/10/08/26/199228/Making-Ubuntu-Look-Like-Windows-7

There’s the latest; why is everyone trying so hard? There’s the usual answer; the more you make OSS look like proprietary software, the more likely that n00bs will give it a shot–but does this turn you off of the individualistic nature of OSS?

Bookmark and Share
26
Aug
2010

Can your ideas be TOO revolutionary?

When I came up with the idea for Fanvertise….

http://fanvertise.com/

…I worried about people stealing it until I had a chance (as I’ve done now) to trademark and patent protect the concept.

Maybe what I actually should have been worried about was no one understanding it, and hence ignoring it.

http://developers.slashdot.org/story/10/08/21/1729233/Google-Wave-and-the-Difficulty-of-Radical-Change

Slashdot’s article on this concept might have done me some good. In the last two years, I’ve seen some changes to traditional advertising models, but I’ve never seen anyone come up with my concept for using social media marketing to create a customized commissioned sales force.

Yay?

Bookmark and Share
21
Aug
2010

Get emailed a portion of classic literature each day.

Ok, so I am feeling guilty over not reading enough GOOD books.

So, I devised a cunning plan whereby I am emailed a portion of a classic book each day. I started with the Iliad. I know that I’ll clear my emails every single day because a cluttered inbox irritates me…so this is the perfect motivational tool. I wrote each of these scripts (with occasional help from the lovely folks who hang out with me in Programming Talk at the Ubuntu Forums), and this is the way I did this.

(1) Download a book you want to read. I suggest starting with something like the Iliad or Ovid’s Metamorphoses. Poetry is a great way to start; it’s episodic and fun. Head to Gutenberg.org to find text versions of any book you want. Other suggestions: the Aeneid, any Shakespeare play, the Divine Comedy, Paradise Lost, etc.

(2) Drop it into a folder, renaming it ‘[whatever].txt’. In my example, I’m dividing the Metamorphoses.

(3) Navigate to that folder at the CL.

(4) Run this script to divide the book up into 300 line segments (or, if there is no paragraph break at 300 lines, the script will add more lines until a paragraph break is reached. That way, you don’t end up getting half a soliloquy). Obviously, if you want to read more or less each day, change the number of lines to however much you want:


#!/bin/bash
bookcounter=0
linecounter=0
sed -i 's/\r$//' metamorphoses.txt
while read line
do
((linecounter+=1))
if [[ $linecounter -gt 300 && -z "$line" || -z "$output_file" ]]; then
linecounter=0
((bookcounter+=1))
formatted_bookcounter=$(printf "%03d" $bookcounter)
output_file=metamorphoses${formatted_bookcounter}.txt
echo "...starting segment $output_file"
echo "Metamorphoses - segment $formatted_bookcounter" > $output_file
echo "===================" >> $output_file
echo "" >> $output_file
fi
echo "$line" >> $output_file
done < metamorphoses.txt


(5) In your folder, delete the big file. You should now have several (or possibly several dozen or hundreds) of much smaller files, numbered consecutively.

(6) Then, run this script (Adds a subject header to each of the files in your folder) :


#!/bin/bash
FILES="*"
for f in $FILES ; do
sed -i '1s/^/Subject:Your Daily Book Part, Tarah.\n/' "$f"
cat "$f"
done


(7) Then, add this script to wherever you store your scripts. It sorts the files in your pet directory by number, gets the first one (i.e. ‘metamorphoses024.txt’) mails it to you, then deletes that file. Then, the next time the script is run, it will get ‘metamorphoses025.txt’ as the first file in the directory. Call it ‘bookmailer.sh’ or whatever. NB: you must have msmtp installed to make this work. Ensure it’s reachable through your path. Any other command line emailer will also work; I know how to use msmtp, so that’s what I do. Plus, I use Kubuntu, so it’s available at the repos.


#!/bin/bash
cd /home/tarahmarie/Documents/MyEbooks/aaa/
FILE=$(ls | sort -n | head -1)
cat $FILE | msmtp -a gmail youremailaddress@gmail.com
\rm `ls | sort -n | head -1`


(8) Execute ‘bookmailer.sh’ at the CL to ensure it works. If, in a few seconds, you get an email containing the subject line ‘Your Daily Book Part, WhoeverYouAre’, then the command is working. If you’re having any problems, ensure that you have permissions to each of these scripts, and that they’re marked ‘executable’.

(9) Add ‘bookmailer.sh’ to your system’s list of scheduled commands. I use kcron, so I set ‘bookmailer.sh’ to be executed each day at 8AM.

(10) Feel superior to other humans for the fact that you’re reading a ‘good’ book every day. This is DEFINITELY how I’m going to get all the way through War and Peace. Eventually. Let us not even speak of Remembrance of Things Past. I will CONQUER you, Proust, ole buddy. Read the rest of this entry »

Bookmark and Share
11
Aug
2010

The best ebook format.

I’m transferring most of my fantasy and science fiction to digital versions. There’s a sort of sadness involved with doing so; these books have been my friends for decades, and I love them.

Still, there’s something to be said for NOT spraining my thumb trying to hold the latest Goodkind or Jordan or Silverberg hardcover in the bathtub.

I’m going with a Nook, and I’m building an ebook library of epubs, since it’s an open format with OSS tools at the CL for conversion and maintenance.

After all the preaching I’ve done, I should be the first to acknowledge that content and means of distribution are NOT the same thing…but there’s a hint of sadness as I sell my copies of the Feist/Wurts Empire trilogy. I love the cover picture on Servant of the Empire; it’s AWESOME.

I’ll miss the books…but not while I’m moving, not on the airplane, not when I’m decorating, not in the bathtub…wait. Why didn’t I do this before?

And does anyone know how to get a copy of that cover as a poster?

Bookmark and Share
01
Aug
2010

Simple tip to make Android easy to access…

…via your home wifi server.

(1) Install On Air from the Android Market.

(2) Ensure that your home wifi is accessible through your phone’s Settings menu.

(3) In On Air, set your preferences to “use the same 4-digit code”.

(4) Hit the big button to turn on the FTP server on your phone.

(5) In your chosen file manager (mine is Dolphin), FTP into the phone, using the 4-digit password generated by On Air. Save the password, and bookmark/save that FTP location to your Places view or some easy place to find it.

Bingo! Now, you only have to hit the big button on On Air and browse to that place in your file manager to remote-access your phone.

Bookmark and Share
21
Jul
2010

Icy cool…but for how long?

The polar ice caps are melting.

I’m not a global warming theorist, and I have no real opinion on climate change. I mostly don’t hold forth and/or pontificate on things I don’t understand, and as a scientist, I think it’s my obligation to not discuss matters that I haven’t researched.

There are a few pieces of incontrovertible evidence of some form of global climate shift, however. Whether or not there is any effect on that shift caused by humanity is a subject for more dogmatic minds than my own, but I do see the differences in the ice caps shown in these pictures.

http://www.bbc.co.uk/news/world-south-asia-10660130

I’m not sure what to make of those pictures, but I’m uncomfortable with the notion that when I climb Mt. Everest in about five years (when I’ll have trained to do so and have awesome pink climbing gear) that the accomplishment will matter somewhat less than Hillary and Norgay would have hoped.

If it’s a simple stroll to a lovely grassy peak, what’s the point?

Bookmark and Share
18
Jul
2010

Ensuring Insurance Elicits Illicit and Affected Effect

I have a T-Mobile G1/HTC Dream. It just died. About 4 months ago, it started choking in the faintest stirrings of its coming death throes.

4 months ago, I still had insurance on it. I canceled my insurance (you know, the 6.95/mo T-Mobile charges to ‘insure’ your phone), since I discovered that the deductible for that insurance was close to $200.

That’s right, the phone I got from T-Mobile for $199 and insured at $7/mo for two years (total: $166.80) is replaceable–for $200.

Why the devil didn’t I realize that this is a MOBILE PHONE company, and as such, will find a way to screw me?

As a result, and most certainly the saddest part of this situation: I just bought another G1 on Ebay for $116, shipping included. I could have saved more than $50 even WITH buying a new phone…simply by ASSUMING that all cell phone providers will find a way to screw their customers.

Lesson learned.

PS: I’ll have a phone again in two or three days. Through T-Mobile’s insurance plan, it would have been 4-6 weeks to have mine replaced.

Bookmark and Share
14
Jul
2010

Dress for inconspicuousness.

When I first got a gig at Microsoft, my account rep noted that I seemed to dress very differently when I came into the vendor agency office and when I was actually at the Microsoft campus.

I tend to downplay my fashion choices when I work as a coder. It’s hard enough to get taken seriously as a female coder without letting my fellow nerds know that I happen to ADORE red sequins and stiletto heels. Given a choice, I dress more like a character in a video game than the person who programmed said video game.

Still, the choices I make as a coder and a female when it comes to the way I present myself offers up an ethical dilemma.

Am I betraying some sort of Chick Code by dressing down so as to not startle my male colleagues? I don’t mean by dressing work-appropriate; there are many choices of work-appropriate attire that would be far more flattering to me without being at all immodest or unprofessional. I mean a deliberate choice to not wear makeup, or heels, or skirts, or my beloved rhinestone hair accessories and 20s vintage jewelry—in favor of t-shirts, jeans, ponytails, and trainers.

If you’ve seen Criminal Minds, you know that the resident tech genius Miss Penelope Garcia wears AWESOME clothes, jewelry, and accessories. I tend to have the film noir version of her taste in clothing. Hell, let’s be honest: I weekend warrior as a renaissance reenactor and live action roleplayer; I LOVE costuming and looking good.

Still, am I being unethical by failing to live up to my sense of personal expression within professional guidelines? When I was in graduate school in Michigan, I experienced repeated and vicious sexual harassment (and on more than one occasion, actual assault) when dressed in feminine attire, and much less when I wore t-shirts and no makeup.

Should I have kept expressing myself and fought the good fight? Am I being untrue to myself now when I dress down to deliberately appear as a Plain Jane? Am I being disrespectful to the women who broke into the profession I now follow?

What’s a girl to do?

Bookmark and Share
25
May
2010

Is “rooting” unethical?

I have a friend–we’ll call her “Sarah Keeler”–who owns a G1 phone. This is an HTC Dream, if you care about such things. It’s made to work on the T-Mobile network, which happens to be “Sarah Keeler’s” cell phone provider.

Sarah rooted her phone so she could use it as a 3G (refers to the speed of the network) modem for her netbook. This is expressly against the terms of Sarah’s T-Mobile contract, and she knows it.

What is rooting? In essence, a smartphone is just a handheld computer–the second cousin to a scientific calculator. Most people use their computers with a GUI, or graphic user interface. A GUI, like Windows or KDesktop or GNOME or Enlightenment or whatever the unholy Mac user fanboy conglomerate uses–is just a series of windows and menus that are designed to make using a computer easier. On many operating systems, it’s hard to get behind the GUI and get to a command line–sometimes that’s because the code is proprietary and the makers don’t WANT you to see what’s happening behind the curtain.

That’s the case with Android, the operating system for Sarah’s G1. In simplistic terms, because T-Mobile doesn’t want to allow their cell phone users to use the unlimited data plans provided for their cell phones as a modem for their computers, the capacity to ‘tether’ your phone (by plugging it into your computer via a USB cable or by setting up the Bluetooth modem) is not available as an option on the standard Android installation on these phones. The real irony here is that Android is an open source operating system that a community of developers all work to support, and T-Mobile is deliberately limiting Android’s capacity.

T-Mobile doesn’t actually WANT users to USE their unlimited data plans; they merely want to advertise the existence of the plan. As a result, anything that could make the use of that plan easier isn’t available as an option on the phone.

So, rooting. To root a phone is to install an operating system of your choosing as opposed to the default one that comes on it. Sarah chose to use a CyanogenROM; this is basically an Android OS with a LOT more bells and whistles–it unlocks the REAL functionality of the phone. Tethering this phone now is a matter of heading to the settings and activating it.

So, what are the ethics of this situation? When I consider Sarah’s situation, I see two different sides. First, I see that T-Mobile is providing a service that Sarah is under no obligation to use. Sarah could go without cell phone service, or abide strictly by the terms of service provided by T-Mobile. T-Mobile offers an additional plan for netbooks and laptops; it’s a card you plug into the back of your computer. Think of it as a cell phone with no dialpad or screen; it only exists to plug into the 3G or Edge networks that T-Mobile supports. Needless to say, this is a separate service and has overage charges (I believe that they have an asterisk on that unlimited data plan, meaning that it’s not REALLY unlimited if they don’t like the amount of bandwidth you’re consuming).

T-Mobile as a company is not obligated to provide service to anyone. Regardless of the fact that Sarah specifically bought that phone to use as a mobile data point and a modem, T-Mobile was very clear in the TOS that tethering is not allowed. Just because Sarah didn’t know what the word ‘tethering’ meant when she read the TOS (ok–SKIMMED the TOS) doesn’t make T-Mobile liable for her ignorance.

And then there’s the other side of the argument. Everyone needs a cell phone. We could argue about the consumerist culture and whether your possessions own YOU, but the facts on the ground are that people need to be reachable for their jobs and social lives, and the expectation that they ARE available creates the necessity for them to BE available. I don’t know too many employers who would be thrilled to know that their employees are not reachable over the weekend, period.

T-Mobile offered a phone with an unlimited data plan, and didn’t bother to explain to anyone that you can only use that plan in ways that are severely circumscribed and functionally useless to someone who wants to use this phone as a mobile data point. It’s the same problem as Comcast has when they advertise their unlimited data plan for a cable modem; they’re happy to advertise the existence of such a plan, but if you go over 200GB of bandwidth in a month, they start calling you up and letting you know that while what you did isn’t against the TOS, they will exercise their right to not service your home any longer if you do it again…because they can end their service to you at any time, for any reason.

T-Mobile is playing the same jiggery-pokery with their advertising. Sarah purchased a handheld computer, and should be able to do precisely what she wants with it. To not be permitted to do so is the equivalent of Dell selling you a laptop and telling you that even though you own that hardware, you are absolutely not permitted to install anything other than Windows on it–or they’ll never sell you another laptop again. While there are dozens of computer manufacturers, our choices for cell phone providers are distinctly more limited.

Sarah owns a piece of hardware; most of its usefulness, however, comes from a service that operates WITH that hardware. At what point does Sarah’s ownership of that hardware become subsumed by the right of the service provider to dictate how she uses it?

Bookmark and Share
13
May
2010