Posts Tagged ‘geek stuff’

Posted by Mikko at 18 February 2009

Category: Personal, Programming

Tags:

Geek
(from XKCD)

Offtopic: In line with the comics above, I always find my self in the same situation. I love to do this with plate numbers. :D

These past few months were the most dormant periods of my geekiness. I badly need to expand my knowledge.

I have hunger for knowledge. Some people may find it weird but it’s actually true. It’s fun to have passion for learning stuff you’re interested to. Don’t think of me as a college nerd reading all those Bio, Chem and Physics books. I’m not interested on those stuff  except those rare moments when I felt geek enough to make simulation of scientific concepts (so far, I’ve made a simulation for freefall and projectile, road traffic and matrix multiplication).

The latest bit of geekiness I got was from my Computer Science class. It’s only this semester when I got a pretty good picture of real Object Oriented Programming. I knew about it before but I only had the chance to get a clearer picture of it on our class.

Currently, I’m interested on studying Python, Ruby on Rails and JSP. I’m tired of PHP, seriously. I’ve been obsessed with the language since I learned it three or four years ago. I’m also interested on making an application using any API. I’m thinking of making a web application that has something to do with geographical information (so that I can use Google Maps) like generating a map, like a Map of Misfortune [I'll discuss this later].

The BIG problem now is where to start. Do I start with Ruby on Rails or what? That I still do not know. I need help.

To the other geeks, feeling geeks (like me), aspiring geeks, retired geeks and non-geeks out there, I need your suggestions. It could be a programming language or an API to explore. Please respond thru the comments section. I am THIS pathetic to expand my knowledge. Waaaaaaaaaaaaa.

Posted by Mikko at 31 December 2008

Category: Random

Tags:

I read about this news in Reuters.

Several hours from now, we will all be ending 2008 — greeting a new year. But hey, we won’t be greeting a New Year at 12:00 midnight and 0.0 seconds. 2008 is extended by one second!

Unlike other leap years in which we add another day to a year, 2008 is something different — a leap second is added. This is a result to the gradually slowing rate of  spin of the Earth along its axis.

Countries around the World will be injecting the leap second on the last second of 2008 in UTC (December 31 2008: 23:59:59 UTC). The decision was made by the International Earth Rotation and Reference Systems Service, an international body responsible for adding or removing a second to the World Time based on the Earth’s rotation.

The latest injection of a leap second was last December 31 of 2005. Leap seconds can be injected on the end of the months June or December.

Anyway, how do we describe the time during that instant? December 31, 2008, 11:59:60 pm?

Posted by Mikko at 23 December 2008

Category: Programming

Tags: ,

DISCLAIMER: For those who are not interested in PHP, you better not bore yourself with this post.

It was ages ago since I made posted some really geek stuff. I think I had to live up with my blog title, Build that Geek — and so I had to rebuild the geek inside me.

bot

Overview

An hour ago, a brilliant idea was distracting my sleepy brain (it was around 4am). The idea was shining so much that my eyes were blinded by it (my pair of eye was facing the inside of my head). At first, I was hesitant to do it by I eventually gave in.

The idea was to create a PHP program that would notify me thru SMS and email every time a PRC Board Exam result is released. The program would ran every five minutes by means of creating a cron job that would execute it.

The program flow are as follows:

  • START
  • The program, thru the PHP server would contact an external source requesting information.
  • The external source would feed the requested information back to the PHP server.
  • The program would parse the data in a PHP-readable format.
  • The parsed data will be filtered (non-PRC related stuff would be dropped).
  • CONDITIONAL: Was the parsed data previously been sent:
    • if yes: END.
    • if no, continue.
  • The program will notify me regarding the PRC Board Exam result release thru SMS [thru an SMS Gateway] and email [thru PHP's mail function]
  • END

The Search for Source of Information

gmanewstvlogo

I strolled around the Internet. The most reliable source I could have is the PRC Official Website. I visited the website and tried to search for an RSS or a well-organized XML file. Too bad there weren’t any. I thought of extacting information from the website the dirty way (using eregi, str_replace, and other string manipulation functions) but it was too much for my tired brain.

The next one was Philippine Daily Inquirer’s inquirer.net. I immediately searsuched their site and poof, there’s this XML feed. I thought it was all fine but when I checked it, it was pretty outdated. If I’d use it, the program would defeat the purpose of informing me really fast of the latest news.

Next was ABS-CBN News. In their Public Service area, they served PRC Board Exam result news. They supplied an RSS feed, but sadly it was blank. It contained no information.

The last one who successfully won me was GMANews.tv. I checked their site and they were also serving PRC Board Exam result news. I learned that they publish it on-the-go on their Nation section. Their top stories section had a usable RSS feed, woot. Finally, I’ve got it.

Data Parsing and Extraction

The next thing to do was to extract the data. How could I parse the RSS feed in such a way PHP would understand it well. Since Google is my friend, I tried googling my problem. Google (search engine) introduced to me Magpie RSS, the program I was looking. Just feed an RSS feed to Magpie RSS and it would break the individual feed items into arrays.

Implementation of Magpie RSS to the program was easy since they have posted a simple how-to on their website.

Filtering the Data

0002_thebigloser_billjunk

Since it was a Nation section feed, not all items on the feed were regarding PRC. There was a need to filter it out. The easiest way that came into my mind was to match either one of the following string “prc” or “professional” to the feed descriptions. If the feed description contained the said strings in a non-case-sensitive way, then retain the information; else drop them. What I used in this part was the eregi function.

Notification and all sorts of stuff

The next thing to worry about was on how to notify me. I also realized that previously sent news did not need to be sent from time to time. For this, I made a MySQL database that would save previously sent information. If the information about to be sent is not on the database, then send it; otherwise, don’t.

The email notification was easy. Gladly, PHP has this easy-to-use mail function. For the SMS notification, I used a free SMS gateway.

Keep it running, indefinitely

Since the program needs to run from time to time, I made a cron entry that would command the server to run it from time-to-time.

Conclusion

The idea was possible. Barely 30 minutes were spent doing it. Source code may be requested by contacting me thru my contact page (accessible in the header and footer).

Posted by Mikko at 17 September 2008

Category: Personal

Tags: , ,

These past few days, I’m having a hard time balancing my academics, house council work and the slack culture I’ve been used for so many years.

I’ve been guilty for not performing well on my academics. I’ve been guilty for not being so active in doing house council works. But I’m extremely guilty for slacking all day and night in front of my laptop playing with PHP Frameworks (CakePHP and CodeIgniter).

As the end of the semester is fast approaching, I promise myself to perform well on all three fields. I’ll try not to miss a single class, not to miss another house council deadline, at the same time not to deprive myself on entering my sweet slack culture.

Good luck to me. I still have to study well for my upcoming Math17 4th Long Exam this Friday. I still have to finish all my Machine Exercises due this Monday (it was supposed to be by groups of three but since I missed the special Monday class, I have to do it alone). I still have to reply to inbound nonrhetorical House Council letters. I still have to finish collecting data for the Kalayaan Residence Hall Association resident database. I still have to reduce my slack time that it yields an equilibrium when I sum those three fields up.

*******

I got a sure 5.0 for Physical Education 2 (Scuba Diving) for a reason that I was not able to find my class. I went to the venue of my class as stated on my Form 5, time of my class but did not find them there. I chose to enter another class on the same venue (Pool 1) – Skin Diving, for fun. I was not able to “Change Matriculation” from Scuba Diving to Skin Diving for a reason that I can’t find my instructor. I was not able to drop my subject ’cause as I’ve said I can’t find my instructor.

But it’s okay. PE units are not included on General Weighted Average (GWA) computation. At least, I’ve enjoyed swimming on the pool without the snorkels unlike my other classmates. I was able to survive in the middle of a 12-foot pool, again without the snorkels. I was able to enhance my swimming skills. I was able to increase the possibilities of me getting admitted to the Swimming Varsity.

*******

Partner Residents – our buddies from our partner corridors (in the dorm). I had three partner residents, but only know two of them. Since we’re required to have a documentation of a “date” with the partner residents, we dated. We had our dinner last night at the Treehouse (a restaurant near SOLAIR and University Avenue). Since I’m the guy of the trio (supposed to be quatrio [not sure on this], it was my treat. We shared a fraction of our lives to each other. Badly, we had to go early since I still have to attend to a House Council meeting.

*******

Computer Center (UP Computer Center) serves as the central hub that interconnects the fiber-optic backbones in UP Diliman and other UP campuses (Wikipedia). For four months, I’ve been having a good time accessing the Internet thru the facility’s wireless internet. It was fast, as fast as downloading a 700mb file in 40 minutes. How fast is that? One SpeedTest.net evaluation gave me a download speed of as high as 9,000+ kilobits per second [equivalent to 1.xx MB per second download] on a nearby testing station and as low as 1500 kilobits per second [200+ kb per second download]. Cool! But just recently, the internet users there are stuck with a slower and unstable Internet. What do I mean by slow? Only about 700+ kbps on most servers.

I know that 700+ kbps is a pretty fast home internet but being used to lightspeed Internet, it’s crappy slow. Huhuhu, I hope that it gets fixed as soon as possible.

–end–

Posted by Mikko at 26 May 2008

Category: Google, Programming

Tags:

All images and questions from Google Treasure Hunt 2008.

Question:

A robot is located at the top-left corner of a 58 x 64 grid (marked).

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’).

How many possible unique paths are there?

The image is not drawn to scale. For illustration purposes only.

Solution

Since I love PHP, I will be attempting the solve the problem in PHP.

Here’s how I am gonna do it.

Since it is a 58×64 grid, to reach the 1,1 location the robot needs to go down 57 times and go to the right 63 times yielding a total of exactly 120 steps to reach its location.

So the rule is:
Number of times to go down = Y coordinate origin of robot – 1 = numdown
Number of times to go right = X coordinate origin of robot – 1 = numright
Number of steps to reach location = Number of times to go down + Number of times to go right = maxnum

The Plan

Generate

Generate strings maxnum length using two characters of my own choice which will be 0 and 1. 0 will represent movement to the right while 1 will be movement downwards.

I will generate the strings 0000…001, 0000…010 to 1111…111. All must be of length maxnum or in my case 120.

Screening

On the course of generation, one conditional with two arguments will be made.

These are, if the number of 0s and 1s in the string being generated exceed the number of allowable 0s and 1s (numright and numdown), then throw the string and proceed to the other.

Increment the Counter

If it passes the screening, then increment the counter. After the generation of possible combinations, echo or print the number in the counter. The number represents the number of possible movements.

Optimization

The code to be used could be optimized by:

  • screening should be done every after generation of a complete maxnum length string instead of screening the string while generating it character-by-character.

My head is already aching! Waaaa, I wanna solve it during the week. I won’t stop until I solve this. Amf!!

Try to play it here.