Skip to main content

Posts

Showing posts from April, 2011

Contrasting Styles of Writing: English vs. Spanish

There is interestingly enough a big difference between what's considered good writing in Spanish and English. V.S. Naipul winner of the 2001 Nobel prize for literature publish an article on writing. In it he emphasizes the use of short clear sentences and encourages the lack of adjectives and adverbs. Essentially he pushes the writer to abandon florid language and master spartan communication. This is a desired feature of English prose, where short clipped sentences are the norm and seamlessly flow into a paragraph. In English prose the paragraph is the unit the writer cares about the most.

This is not the case in Spanish where whole short stories (I'm thinking this was Gabriel Garcia Marquez but maybe it was Cortázar) are written in one sentence. Something so difficult to do in English that the expert translator could best manage to encapsulate the tale in two sentences. The florid language is what is considered good writing in Spanish but unfortunately this has lead to what …

Why was Lincoln Murdered?

In this Easter Sunday, day of rebirth, my thoughts go dark and worries weigh on my mind. So to exercise them this post asks:

Why was Lincoln Assasinated?
Why was Gandhi Killed?
Why was Kennedy Shot?
Why was Martin Luther King?
Why was Paul?
Why was Jesus killed?

Their deaths are not coincidences. They're not random fates that come to those of great prominence. They are not French nobles dying under a guillotine in a mass panic of the populace.

Take Gandhi; killed by a man who didn't like the direction that Gandhi was taking the country. A direction away from materialism, away from capitalism, away from violence as a mirage for strength. Years after his death India is becoming an economic force, following not Gandhi's teachings but the capitalism purported by his murderer.

A friend of mine said that capitalism is evil. I don't think so. I think capitalism is like a monarchy lead by a dauphin, with all its childish desires who with great advisor and guidance can be a gre…

Selfishness is not a virtue

The movie Atlas Shrugged (pt. 1 of a trilogy apparently) came out this weekend. I've tried to read the book before but it's really badly written and very boring. However neither of those things have dented its influence. It has been hailed as by Conservatives as one of the most important books after the bible. In what I believe is a bout of self-reassurance. The main thesis of this book, and mind you this book has a didactic thesis in it, is that there is no higher virtue than selfishness. In the world where this story takes place selfishness has become unacceptable socially (not spiritually btw) so in a rather comical exchange (well comical for me) a successful big brother industrialist donates money to his conceited little brother's cause and the brother will only accept it if he can hide where it came from so as not to be embarrassed by the selfish industrialist brother. Now this is funny because the big brother is doing something very altruistic, very unselfish. He is …

Sprint Fast, Squished Frogs and Overloading. (Ruby Program pt. 12?)

I've decided to take an online Ruby course. I started last Saturday. I've put aside the FBI-website reading project to the side a bit, since I need to get more core basics before I tackle that one. One of the first exercises on the class has to do with the "sprintf" documentation and this bit of code:

puts "%05d" % 123

This looks like the modulo operator from before (see my previous blog) so it left me totally confused. I tried to get more explanations but all seemed to follow the equational approach: see the formula, see how it works, understand. This approach must work for some people but I totally don't "get" it that way. That step three, just doesn't happen. I look at the equation nod stupidly and fail to grasp it.

When I look at spritf, I think Sprint Fast and imagine runners gunning it and don't get what the percentage sign is doing there.

Finally I happened upon Why's explanation in his book, which soooo needs an index. His e…

The Oscar's Speech

Have you ever dreamed what you'd say if you won an Oscar? Here is a first draft of mine.

I would like to thank all the people that made it possible for me to be here. It is through your effort that we share this award. I promised myself I would not miss the chance to reach such a broad audience and simply express my gratitude to the wonderful people I will name backstage. People whose own accomplishments speak to their greatness and need no one, not me to validate them on this stage. They are wonderful people in their own right.
We have a pressing moral issue at hand that has been ignored for much too long. The Earth, our Environment, is being ignored. For too long the environmental issue has been portrayed as a fight between ecology and economy, between trees and jobs. This is not true.
The moral issue is theft and whether you are okay with it. I don't have children or children of children and I am pissed off at the wholesale theft of the environment; theft from future generatio…

Homelessness

President George W. Bush encourage the home ownership in this country by urging companies like Sallie Mae (I forget the name of the actual one) to lend money to lower income brackets so they can own homes. After the huge cost of bailing them out, and the whole housing crisis this triggered, I wonder if using that money into helping the homeless would not have been a better idea and use of that money.
Today I met Susanna a homeless woman from Brooklyn while walking to get my groceries at the corner market Trader Joe's. Clean, bright woman that as many homeless has trouble finding a place that is safe to sleep. She hadn't slept in three days. We talked for a bit. She didn't look homeless with her bright purple headphones attached to an almost retro cassette player and wearing a jean jacket full of pins, she looked like a new age lady. Her hair she told me, while clean was a mess and so she hid it with a proud Brooklyn cap she'd gotten as a gift. A friend of hers is puttin…

Shinny new toys for wealthy companies

This week Cisco announced it's killing the Flip, the super simple video-recording camcorder that was such a hit that Cisco bought it for $590 million two years ago.

This seems to be a typical thing big companies do. Microsoft bought Danger the maker of the popular Sidekick, had them made the Kin (Microsoft's way) and then killed it. Activision bought the Guitar Hero Franchise, then killed it (buried it actually, by milking it for all it was worth then essentially laying off the developers).

Makes me wonder if this is a new-toy syndrome. The company buys a shinny new company and it's excited until the new-car smell wears off, then they dump them like a petulant child that should be Harry Potter's older and portlier cousin.

But what I really think is going on is bad planning and unrealistic expectations. I think Cisco bought Flip with the impression that it was going to give money like a cow gives milk. The minute they start under-performing, they just extirpate it like …

Delving into the 7th level of Unicode Hell (Ruby program)

When the three brothers defeated the Titans and had the whole cosmos to divide among themselves, it was the oldest ᾍδης who got the Underworld. A kingdom I seem to be quickly descending on my innocent trip to down Ruby programming. I set out to do a little program that would reverse text like ᾍδης particularly useful for Hebrew and Arabic. But then I found myself entering...

A Glance into the Unicode Underworld
Kairon ferried me across while I was sleeping, because suddenly my little program is facing a huge issue. Ruby doesn't fully support Unicode.  As I searched deeper into this Unicode world I found I was in bigger trouble than I originally thought. ANSI, the common encoding of Ruby, is 8-bit encoding. So I thought, well Unicode must be 16-bit encoding, more bits more letters -- problem solved! Just find a way to split off two 8-bit character chunks at a time and stack them on a new line and voilà! We have the text reversed. I even found a way of doing that. If you have a stri…

New Project (Ruby Programming pt. 11)

Ok so with the reverse-text project, all I need to do is learn how package it as an app or exe. Not so simple but since it's not covered in my books I'll have to ask it out. So I've come up with another project. It's a Rails project so it's way in the future, but I'll guide myself in that direction.

I want to make a website that calculates how much of your taxes go to different programs each year and presents it in a nice-looking pie graph. It would give you the average federal tax paid in your state and how many dollars of each went to whatever project. The cool thing is that this website would be a data aggregating website. It would scour the websites that have the data and compiles the graph for you. I'll host it on Heroku. Of course, I'm way far away from diving into Rails but, BUT, Ruby can parse websites. So I'll make a stand-alone program that does that first, and renders its output in HTML all ready to be dropped in on a rails project.

Howev…

3 Secrets to Teach Yourself Programming

These are three secrets I've learned that have made learning Ruby much easier than when I tried to learn Python.

1. Have Multiple books. I have three books for Ruby and this allows me to look up my doubts in one in the others, plus I get totally different perspectives and order of priorities. I have two pdf ebooks (one of which I printed) and one physical book. They are: why's (poigniant) guide to Ruby, David Black's Ruby for Rails, and Satish Talim's Ruby ebook.
2. Don't Read in (strict) order Jumping around can be useful as you can learn something while you jump around but also this allows you to approach topics that the author may think are hard but you find easier in a quicker way. The only book I'm reading in order is Talim's ebook. I read it mostly in order because the topics he presents build on each other but are not presented in order of complexity. In one paragraph he'll introduce a very hard procedure very quickly. On why's book I skipped a w…

The Japanese Roots of Ruby (Ruby Program pt. 10)

Before starting to learn Ruby I had attempted to learn Python. They're very similar languages in terms of use, both dynamic, object-oriented, scripting languages.

I picked Ruby to learn because when I looked at the code it made sense to me. I didn't have to try to do a mental jump so high from the beginning. At first I could not see any Japanese influence on Ruby. Ruby was created by a Japanese guy and it's very popular in Japan, and I speak Japanese.

But now I'm beginning to see and suspect that it has a lot to do with the readability of the language. Let's contrast a simple statement in Python which is written by Europeans. Recently Python went through a mayor revision (which still hasn't completed) that broke backwards compatibility, because one of the main philosophies behind Python is having only one way to do things.

So in Python 2.6 you could say print "Hello World" now on Python 3 you have to say print( "Hello World"). The purpose of…

Packaging the reversor app (Ruby Programming p. 9)

So now that I got the reverse text program running with the help of the L.A. Ruby group, I want to package it as a stand-alone app. Which turns out not to be easy to do, but not for lack of options but for lack of documentation.

I wanted to use Jruby a Java implementation of Ruby because I figure at one point the ruby code goes to Java-byte code so that can be exported and run on any Java machine. And there is a neat Gem that allows you to do this, with the super name of Rawr. But the website one doesn't tell you how to install it (jruby -S gem install rawr) or how to configure it. And two It just shows an example and says "It explains itself! No documentation necessary here." I laughed out loud.

Reverse program done with help (Ruby Program pt. 8)

On Tuesday night I went to the Ruby L.A. group and had a good time. Learned quite a bit. And the reverse program is done! So I described what I wanted to do and Evan, the group leader, had an even more elegant solution.

So my idea was (as I described in a previous post) to go through the line and read each character match it to the Unicode character-sets boundaries (using their hex-code numbers) and ingest it into an array in one or two or three character chunks per element. Then reverse the order of the elements in the array by passing them to another array and output that.

In the group I learned that arrays have a reverse method. So it's real easy to reverse them. But the coolest thing was how Evan proposed solving it.

Scan
Evan used the scan method (one I had heard about but haven't quite mastered) but here is the cool thing, by escaping the characters as Unicode the scan method basically does in one step what I wanted to do in many. Scan will spit out an array of elements t…

"Less taxation = more revenues" mantra is wrong

No clue why this need saying but this statement from House Representative Paul Ryan "if you tax some thing more you get less of it, if you tax something less you get more of it" is wrong.

Not opinion. It's wrong factually.

What actually happens is that there is a sweet spot. A place where more taxation equals less revenue. If you're above the sweet spot on your taxation then, yes, lowering taxes will bring in more revenue. Otherwise less taxation brings in less revenue. Simple enough, right?

The sweet spot is where taxation is so high it's discouraging whatever it is your taxing. Take cigarette smoking. Let's say you wanted to maximize revenue. Where do you want cigarette taxes? Low to medium so that more people will smoke more cigarettes and you'll have a bigger tax base. Of course that's not what we do with cigarettes, there we tax them heavily to discourage use. Ok now let's say taxes were a dollar a pack. Would reducing the tax to fifty-cents…

Unicode -- Uphill both ways (Ruby Programming pt. 7)

I found this cool article on Unicode (it gets UTF-16 wrong but that's ok). However I'm running into a large wall dealing with Unicode in my program. So I'll put it out there so a solution presents itself.

So far my program checks each line of the file to see if it's ASCII only text. If so it reverses it with Ruby's built-in reverse method.

If not what I want to do is to have it read each hex pair (or four-some) decide if it is below U+007F (inclusive) to treat it as plain ASCII and pass the character as one element to an array, if it's between U+0080 and U+FFFF then to take a two byte chunk and pass it as one element to an array. And finally if it is between U+010000 and U+10FFFF then to take a three byte chunk and pass it as one element to an array. Then to read the elements of the array First one In Last one Out (FILO), remove the end of line (/n) marker and put the elements into another array. Join that array add an end of line element and write it to the fi…

Why Windows sucks for development.

So I've been trying to get Unicode characters to display on the terminal. I found that on Windows you have to change the character set to do this. But I had no success.

Then I came across a recommendation to use Windows PowerShell. I was confused. Windows has two shells? Get's worse. Windows 7 64 has at least 3 different shells. And to really give you a headache. All have ruby 1.8.7 though I installed ruby 1.9.2. So What's going on here?



Mac OS X comes with ruby 1.8.7 built-in and upgrading is a one line command from the shell (though I confess all I did was install macruby to get both 1.8 and 1.9 on the same computer). On Ubuntu upgrading is a pain, but that's likely because a new Ubuntu is coming out this month which will (likely) come updated.

So why is the Windows development platform so fragmented? I'm guessing backwards compatibility. Though I think in this case there is no reason why the command prompt couldn't be upgraded and a new one had to be created…

Why the Motorola Xoom Failed

In a recent CNET article, it describes how the Xoom has had little impact on the tablet market and attributes this failure in light of the outstanding success of the iPad to the Apple Stores and their focus on the tablet.

I disagree. I think the Xoom fails because it tries to do what the iPad does but not be the iPad. It's roughly the same size and same specs and almost twice the price. Why would anyone shell out almost $300 dollars more for a product that's just a mimic of the iPad? Better to go with the original.

The only tablet that I've seen that differentiates itself from the iPad is the Galaxy Tab 7 inches. It's used in Spain's EOI (Escuela de Organizacion Industrial) a prominent Business School precisely because of one of it's advantages. It's open-source. But I'm sure the fact that it's cheaper than an iPad had something to do with it too.

The 7-inch tablet is much smaller than the iPad allowing it to be used in a more portable way. In educa…

Building my own home.

I've decided. I want to build my own home.

There is something special about building your own things. I built a desk for my tiny room when I first moved to L.A. My room was so small that I had to sit on the bed to use the computer so I build a high desk so I could sit on the bed and work on the computer. My roommate Trentity helped me cut the ply-wood to the right side. I still have that desk. It now sits on the living room covered by a cloth hiding the surplus of costume parts my current roommate Sean uses in his creations.

Learning to build and fix things continue. And the feeling of satisfaction from fixing even small things is great. So a few years ago I heard on the NPR program the Story about a couple of educators that moved to a tent in their back-yard so they could rent their house and afford to send their kids to college. They had a special type of tent called a yurt and cooked and showered in an RV they had parked next to it. I thought I could do that.

Housing in Los Ange…

2nd Success, Do you leap? pt.6

It's amazing when things suddenly fall into place. So after finding how leap years are a fantastic application of the modulo operation in Ruby, I wanted to make it a .method? operation. This is the one where you go 1352.leap? and it returns true if true and false if false. The first clue on how to make the program work this way came when I read on why's poignant guide to ruby that you can define Ruby classes like string and it simply adds on your method to the present class.

So the first thing I needed to do was find what class are integers. I thought it might be int, but when I started the irb session and wrote 1532.class it returned Fixnum. Cool, so now the first half was in place.

The second part would be how to get it to operate on the number previous the period-method call so I didn't have to put the number as a method argument in parenthesis like the first leap-year program. And here is where the magic happened.

I tried a few things and then suddenly I remembered seei…

Fun with Modulo, Leap Years! and Unicode Hell (ruby program pt. 5)

Unicode Hell
This is cool. I innocently picked a simple problem (reversing text) to learn the Ruby programming language. I got more than I bargained for. Turns out that Unicode is supposed to be handled on the upcoming (since 5 years ago) Ruby 2.0.... great. So I'll have to implement an ad-hoc solution on my own. Part of the problem is that there are so many ways to encode text in bytes. And the other is that there doesn't seem to be a simple standard. The first problem is that Unicode text can be part of multiple character sets with different lengths. The most common UTF-16 should solve my program's problems but will trip up with weird characters in very obscure languages like say Cree. The second problem is how do you figure out which character set is a text in? I'm stumped for now.

Leap Years!
If you read my post on modulo you know I'm very excited about learning about this new programming operation and its use in jargon. (I'll have the protein burger! That&#…