Did you know that the global food output is equivelent to over 3000 calories per person per day? Yeah, that's right. There is enough food that is currently available on the planet to cause a very chronic obesity.
The problem here is that there is too much waste. But imagine if we could cut down that waste. No longer would we need to find so many scientific breakthroughs in order to maintain the increasing population. No more need deal with world hunger. We could also use any surplus food for uses such as fuel and other things that we need to produce a productive society. There are so many possibilities, but the people in charge of such organizations are just too slow.
To address the waste issue, we must educate and spend lots of money in countries that do not have the farming capability that more advanced nations would have. Even though this may seem like money down the toilet, it's better to teach a person how to fish rather than to give him half a fish everyday. Plus, you would never have to deal with them again
The primary problem with this is finiancing, as mentioned before. One of the places that facilitates such deals is the world bank, but that implies that they must return the money. Let's just give it to them and make a deal that they will one day help us fight the problems that we now face as an entire population. Setting aside differences and working towards a common goal will allow us to figure out how to handle the future, helping people lead happier and easier lives.
Wednesday, October 31, 2012
Wednesday, October 17, 2012
My fake pressciption drug commercial
It's the ad transcript for my new drug called Cramming!
Ever feel that studying for many days for a big test just doesn't seem to work? Are you feeling that its really slow and that you have a tendency to forget what you were memorizing the week before? Try Cramming, the only FZA-approved* drug for curing test forgetfulness. Cramming saves time, has better accuracy, and has no side effects on your long term memory. 89% of patients who take Cramming show immediate improvement on tests, and mango farming.
Cramming is not for people with low self-esteem, or high blood pressure. Elderly patients should not take Cramming due to elevated risk of heart attack or stroke. Stop taking Cramming if you have vomiting or cramps in your lower abdomen. Some patients taking Cramming have reported severe pupil dilation after being awake for over 30 hours. This is a rare but serious side effect. Call your doctor immediately if you have any of these symptoms. Cramming is not for everyone.
Talk to your doctor about Cramming today.
*not approved to children under the age of 0
©1023 Yawn4 Pharmaceuticals
Side note: This is a joke. There is no drug called Cramming. If there is, it's probably not this one.
Ever feel that studying for many days for a big test just doesn't seem to work? Are you feeling that its really slow and that you have a tendency to forget what you were memorizing the week before? Try Cramming, the only FZA-approved* drug for curing test forgetfulness. Cramming saves time, has better accuracy, and has no side effects on your long term memory. 89% of patients who take Cramming show immediate improvement on tests, and mango farming.
Cramming is not for people with low self-esteem, or high blood pressure. Elderly patients should not take Cramming due to elevated risk of heart attack or stroke. Stop taking Cramming if you have vomiting or cramps in your lower abdomen. Some patients taking Cramming have reported severe pupil dilation after being awake for over 30 hours. This is a rare but serious side effect. Call your doctor immediately if you have any of these symptoms. Cramming is not for everyone.
Talk to your doctor about Cramming today.
*not approved to children under the age of 0
©1023 Yawn4 Pharmaceuticals
Side note: This is a joke. There is no drug called Cramming. If there is, it's probably not this one.
Monday, September 10, 2012
iPhone UDID leaked. not a big deal
As you may or may not know, iPhone UDIDs have been leaked out onto the internet and peopel are freaking out about this whole incident. While we now (thankfully) know that the UDIDs did not come off of a FBI laptop, that (honestly) does not make much of a difference.
The UDID on iOS devices isn't really a big deal. For developers it's just a way to provision apps to work on devices. Not much interesting here
The UDID on iOS devices isn't really a big deal. For developers it's just a way to provision apps to work on devices. Not much interesting here
Wednesday, August 29, 2012
Why I like garbage collection
One of my most favorite features of java is the garbage collection. Being able to create objects on a whim and then simply forgetting about them is the nicest way to program. Gone are the times when you need to clean up the object. Reference counting becomes a thing of the past. Best of all, no more segmentation faults! (this helps me sleep well at night)
Garbage collection means less time on finding bugs and more time working on the internal logic of your application. It means that more code can be completed in less time. Imagine having a person who picks up all the litter you toss on the ground (don't do this) as you walk through the park, the playground, or maybe across the street.
Alas, it's not all perfect. Tight loops and objects that never seem to go out of scope can and will cause memory problems as well. Garbage collection is also an additional overhead for the application, but that is a reasonable trade-off if you don't want leaky code that will grind the entire system to a halt much faster.
For high level programming there's nothing like GC. It's a shame I mainly work on C-based languages nowadays...
Garbage collection means less time on finding bugs and more time working on the internal logic of your application. It means that more code can be completed in less time. Imagine having a person who picks up all the litter you toss on the ground (don't do this) as you walk through the park, the playground, or maybe across the street.
Alas, it's not all perfect. Tight loops and objects that never seem to go out of scope can and will cause memory problems as well. Garbage collection is also an additional overhead for the application, but that is a reasonable trade-off if you don't want leaky code that will grind the entire system to a halt much faster.
For high level programming there's nothing like GC. It's a shame I mainly work on C-based languages nowadays...
Thursday, August 23, 2012
5 years of Yawn4LifeIng
That's right. On this day 5 years ago, I created Y4L. It was a much different look and feel back then. As I think back to when it was first created, it seemed almost dark and hidden. Now it's all bright and cheerful... sorta.
Anyway, if you've been reading this blog ever since the start. Thank you. And if you just started reading and discovered that this place has been hanging around since the last decade (holy crap), remember to subscribe. The terrorists will win if you don't.
Anyway, if you've been reading this blog ever since the start. Thank you. And if you just started reading and discovered that this place has been hanging around since the last decade (holy crap), remember to subscribe. The terrorists will win if you don't.
Monday, August 20, 2012
Sqlite and a quick trick
Sometimes you need to make SQL queries that don't seem to have your usual columns and rows. The other day I was working on one such example. This time, it was with C and Sqlite.
So that's what I did.
Here's the code snippet:
Not really a big deal, but it didn't really make any sense to me. I tried it out and amazingly, it worked.
Select Count(*) FROM sometable;I had this SQL query that would get me the number of rows in a table, but I realized that the c interface had no obvious way of getting it. After taking a short lunch break, I realized that the output on the command line interface looked remarkably similar to having only one column with one row.
So that's what I did.
Here's the code snippet:
NSString * query = @"SELECT Count(*) from essaystore;";
sqlite3_stmt * statement;
if (sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, nil) == SQLITE_OK) {
sqlite3_step(statement);
int row = sqlite3_column_int(statement, 0); // it's technically a 'column'
sqlite3_finalize(statement);
return row;
}
Not really a big deal, but it didn't really make any sense to me. I tried it out and amazingly, it worked.
Wednesday, August 8, 2012
N days ago Objective-C
![]() |
| What app could I possibly be making? |
After searching the web for a while (on Bing, because I live in the Seattle area) I found this website with a very helpful snippet of code to create what I wanted. The problem was that it was in PHP! Oh dear, I'm not working on PHP, it looks like I will have to keep on searching...
Sadly after searching, I still couldn't find anything relating to objective c and this time ago function. I decided that it would be faster for me to just simply port the code to Objective-C.
Then I remembered my promise last Monday. So here is the first piece of code you will see from me on this blog. (Yes, I can in fact code)
+ (NSString *)ago:(int)time {The class method takes an int for the seconds since 1970. It returns an NSString but can easily be adapted to return a C string if you so incline to do so. Also, if you're one of the strange few people who do high-level programming with pure C, you would only need to change the NSDate to the current unix timestamp in C in addition to eliminating the NSString mentioned earlier.
char * periods[] = {"second", "minute", "hour", "day", "week", "month", "year", "decade"};
double lengths[] = { 60, 60, 24, 7, 4.35, 12, 10};
int now = [NSDate timeIntervalSinceReferenceDate] + NSTimeIntervalSince1970;
double difference = now - time;
int j;
for(j = 0; difference >= lengths[j] && j < 6; j++) {
difference /= lengths[j];
}
difference = round(difference);
NSString * result = [NSString stringWithUTF8String:periods[j]];;
if (difference != 1) {
result = [result stringByAppendingString:@"s"];
}
return [NSString stringWithFormat:@"%d %@ ago", (int)difference, result];
}
Yup that's it! If you want this method available to other classes, I advise you declare it in the header.
Subscribe to:
Posts (Atom)
