Skip navigation

Tag Archives: the few times you’ll ever see me use an emoticon

While technically not part of my 2016 Resolution, I also got this:

66th percentile on HackerRank

You may be thinking, “66th percentile! Three stars! For an Asian, your standards aren’t much.”

Well, considering that I have a full-time job and that just around this time last year I was below 20th percentile, I’m calling this a win. šŸ˜‰ šŸ˜‰

My laptop turned one-year old last Monday. What could be called remarkable for this gadget anniversary is the fact that I had legitimate cause to claim warranty in the allotted one-year period. It’s not a show-stopper defect that required servicing. It’s something minor though it’s one of those minor things that tend to be really annoying.

One day, the down arrow-key button just stopped working (or started over working depending on how you view the symptoms).

That day I noticed that Windows 8 automagically loaded even if I missed the 10-second period where GRUB asks you for a confirmation on the OS you want to load. I did not fuss too much about it since I was about to playĀ Skyrim, and was going to boot into Windows 8 anyway. However, later that day, when I wanted to code and so had to boot into Linux, I noticed the automagic and started wondering.

In Linux, I noticed that the browser randomly scrolls down and scrolling up with anything (mouse wheel, scroll bar drag, page-up, up arrow key) had no effect as it just drags back down. Then I started switching workspaces via the Ctrl+Alt+Down key combo which just didn’t work.

This is where I started experimenting, starting with GRUB. With no further delay, I present you, the symptoms:

  • At GRUB, I noticed that the selection cursor automatically goes down to Windows 8 (the bottom-most option). From there, while in the 10-second grace period, you can still go up (by pressing `up`)Ā but not down.
  • Inside Linux, I noticed that Ctrl+Alt+Left does not work as well.
  • Inside Windows, while in Notepad, the down button really does not work. All the other direction keys seem to be fine though.
  • Inside a terminal session in Linux, pressing `down` does not make your terminal command history go forward.

As I said, not really a show stopper. AtĀ vim, my text editor of choice, I’ve grown accustomed to using theĀ h, j,Ā k,Ā l keys to navigate around my document; for everything else, I have a mouse with a scroll wheel. At bash, I seldom go through my command history via theĀ up andĀ down buttons anyway; I mostly use Ctrl+R (reverse search). As for workspace switching, I can still get to any workspace as long asĀ up andĀ right are still working and wrap-around behavior is enabled. But this defect just bugs my workflow, not to mention the annoying scroll down browser behavior told earlier.

As when this happened, the machine is still under warranty, I thought it prudent to claim it. Everything’s fine, save that I went to this year’s GDG Philippines DevFest without a laptop. I had to leave it with Acer for three weeks as they ordered a new keyboard. Those three weeks, I managed to sleep on time and devote time to my other hobbies.

I wonder what could’ve caused it though.

Now, I’m having another problem, still minor but perhaps less annoying. For some reason, USB mice are working very erratically with my laptop. At first I thought that the one I’m using just failed. I’ve been using it for less than over a year and it’s not any recognizable brand but one that has sentimental value; I wouldn’t want to let it go too easily. Ā But I just bought an A4 D530FX, saw that it works well with my computer at workĀ but not with my laptop. I’m not sure if I should feel happy or sad that I seem to have established that my no-namer, sentimentally-important mouse is still fine1 but my laptop may be in for another maintenance check.

(In retrospect, I could’ve saved myself a few hundred pesos by plugging my sentimentally-important mouse to another computerā€”like the laptop my sister is using, or the old Windows XP desktop which we only keep for printing, or the beast I use at workā€”and check if its working fine there. Oh well, back-ups can still be considered an investment no?)

It’s not a big problem as the touchpad is still working fine. What suffers is my Skyrim. Damn. :(

With that all said, I’m still pretty pleased with my laptop. Though I, as part of being a “wise consumer”, do check out reviews of products before buying them (especially when I buy uber-new products, like what I did with my XPeria Z), I do not place that much value in them. It seems to me that most reviews today come from people who have just used the product concerned for a test drive, just in time to write a blog post about it (and get their paycheck). Well, I’m buying things not to use them for a test drive but for a pretty long time. I’d actually like to see my purchases as investments.

After a year, I think I’m in a position to make a short review of my laptop no? Quoting from this blog’s “About” page as of this writing:

Unit Model: Acer Aspire V3
Processor: Intel Core i5 (2.5GHz) with Turbo Boost up to 3.1GHz.
RAM: 4GB DDR3
GPU: NVIDIA GeForce GT 630M with 2GB dedicated VRAM
Operating Systems: Linux Ubuntu 12.04 LTS (Precise Pangolin) and Windows 8

So well, the pros: I think it looks really sleek. It’s no MacBook, but I find the design really aesthetically pleasing. It is not as light as I would’ve wanted (when I bought this, it was due to an emergency; it was still quite out of spending schedule) but I’ve no issues with weight since, unlike when I was in undergrad, my laptop mostly sits on my desk at home now. Plus points for having the order of the Ctrl, Fn, and Super2 keys in the same order as my previous one.

The specs may not be top-notch but it is sufficient for games (Skyrim,Ā Civ V, KingsRoad, anyone?) and the side projects I’m doing. I find that Windows 8 really plays nice with it, though it is not a touchscreen model. Though I think it must be said that I’m way more pleased with Windows 8 than your average Lifehacker commenter.

And yes, there are cons: one of my very first issues with it is that it doesn’t have any indicator if I’ve my Caps Lock on. It may not be a big issue for most users but it does bug me: imagine getting your web passwords wrong only to find out that you’ve accidentally hit Caps Lock on. There’s also this weird bug it has on Google Chrome where GC suddenly hangs for no apparent reason. It happens for both Windows and Linux but Linux does not seem to be able to recover. I’ve checked the logs, reported, and Googled about this bug but I don’t find much. I guess it’s an architecture-level issue, then? I’ve switched to Chromium in an attempt to isolate the problem further but to no avail.

 


So, hey, a keep-alive. Between me not being able to keep my New Year’s Resolution (at least the part that tells me to write about my experiments here) and some other problems, personal and/or technical, I’ve been going through lately it feels refreshing to be actually writing in casual English instead of code.

See you around! ~Chad

  1. Though you may say that this needs further testing, I noticed that it works quite well in Linux but really annoyingly erratic in Windows. So yes, sentimental value and all it must be still fine. []
  2. The one with a Windows logo printed on it. []

Due to the nature of the algorithms we are testing for our thesis, we had to “prototype” the procedures in Matlab so that we can easily modify parameters and test variables. However, since Matlab is expensive and we are a university that does not tolerate piracy ;), we used GNU Octave, a FOSS equivalent of Matlab (think Mono for C#).

We are done with the algorithm-prototyping part and we are now porting our Matlab code to Java, since this thesis is meant to be used by scientists, with a GUI and all that comes with standard software. Ā A big part of this task is in coding the functions that are built-in in Matlab; remember that Matlab is meant specially for mathematical purposes (it is a portmanteau of Matrix Laboratory) while Java is more general purpose, closer to metal, if you will.

For the past few days, I’ve been trying to implement the Matlab function rgb2gray which, as the name suggests, converts an RGB-colored image to grayscale. Now, there are a lot of ways to convert an image to grayscale but getting a grayscale isn’t the main point here. Getting it the way Matlab/Octave does is essential so that we can recreate in Java the recognition accuracy we achieved in Octave. We will be manipulating these pixel values after all.

So, I looked into Matlab’s documentation of rgb2grayĀ and found that, for a given RGB pixel, it gets the the corresponding grayscale value by the following weighted sum:

0.2989 * R + 0.5870 * G + 0.1140 * B

(Or something close to those constants/giving the same priority over the RGB components. That is, green most weighted, followed by red, and then blue. This priority reflects the sensitivity of the human eye to these colors. See Luma (video).)

I then ran some tests on Octave to verify the docs:

octave3.2:1> four = imread("four.JPG");
octave3.2:2> four(1,1,1) # The red component of the first pixel of four.JPG
ans = 159
octave3.2:3> four(1,1,2) # The green component of the first pixel of four.JPG
ans = 125
octave3.2:4> four(1,1,3) # The blue component of the first pixel of four.JPG
ans = 64
octave3.2:5> grayval = 0.2989 * 159 + 0.5870 * 125 + 0.1140 * 64
grayval =  128.20

So, the grayscale equivalent of the first pixel of four.JPG will have the value floor(128.20)=128. Sure enough, when I encoded the procedure in Java, the first pixel of the grayscaled four.JPG has the value 127ā€”close enough taking into account the possible differences in how Java and Octave handle floating point computation.

But wait, there’s more…

octave3.2:6> fourgray = rgb2gray(four);
octave3.2:7> fourgray(1,1)
ans = 116

The value of the first pixel of four.JPG after rgb2gray is 116! Now that’s something no amount of discrepancy in floating-point handling can account for. Besides, hasn’t Octave itself computed a value close to Java’s 127 when done manually?

That’s when I realized that Octave may not be an exact port/clone of Matlab after all. I decided to Google “rgb2gray octave” and, sure enough, the documentation of Octave at SourceForge points to a departure from Matlab’s implementation:

Function File: gray = rgb2gray (rgb)

If the input is an RGB image, the conversion to a gray image is computed as the mean value of the color channels.

And verifying the docs…

octave3.2:8> floor((159 + 125 + 64)/3)
ans =  116

Problem solved.

I’m pretty sure that this isn’t the only difference between Matlab and Octave. The next time I encounter another one, I’ll try to document it here, time permitting.

BONUS: My encounters with Octave so far gives credence to this but I have yet to verify this thoroughly. It seems that Matlab/Octave loops through matrices (arrays of at least two dimensions, in Java/C-speak) column-major order. This isn’t exactly difficult to do in Java/C but Java/C programmers are more used to traversing multidimensional arrays in row-major order, since this should result to less page faults and therefore faster code. Still, for some computations, the order with which you traverse a matrix matters a lot. Be careful there.

Remember my portfolio website? The one I mentioned here? Well, it’s now up and accessible at kode.skytreader.net. There isn’t much there yet because I tried to make it a point not to link to school work1 but pleaseĀ feel free to look around the various things I craft. The CSS should look good for all browsers except IE. This is my first attempt at tableless layout and, man, IE really is a pain in the ass to work with. The main domain (www.skytreader.net) uses tables, unfortunately.

In other news, I’ll be doing my thesis/special problems course this year. I don’t know how much time will I be able to squeeze in for personal projects. I expect {kode.play();}2 to be as much in thesis mode as me. In any case, I can still consider my thesis as a personal project, don’t you think?

(By the way, by some turn of events, I’ll be doing my thesis alone. At least, so long as the list of accepted students released by the research lab I applied to doesn’t change. I guess that just makes my thesis all the more a personal project.)

And as for my n-puzzle solver? I haven’t had time to look into IDA*, as I planned in my previous post. The time I spent working on it the past two weeks or so, I spent on ways researching how to decrease the heat generated by my laptop’s CPU. I’ve cleaned the dust bunnies and all but it still overheats to the point of auto-shut down even when I’m just browsing the web, though so far that has only happened in Windows Vista. I’m pretty adamant continuing to force my laptop to its limits sinceĀ I’ll be doing my thesis this year and being laptop-less is the last situation I would like to find myself in.

(It’s been raining real heavy the past few days though and I noticed that my laptop is going easy on heating up. Could all those auto-shut down heat-ups be due to the hot summer weather? That’s funny since I had this laptop since last year’s summer and it didn’t auto-shut down at all then. And last year’s summer was way hotter, I tell you.)

Aside from my thesis, I’m taking my Artificial Intelligence course this semester. Maybe, hopefully, there really is still something I missed from A*. Having someone explain it to you really makes a lot of difference from self-studying. Hopefully, by semester-end, my n-puzzle solver can solve a randomly-generated solvable instance.

That’d be all for now. See you soon.

  1. Okay, this breaks forĀ GradeGrid but I invested so much time in it it’s good as personal as well. []
  2. Yep, that’s the new official spelling :D []

At last. We’re doing what I really anticipated us to do. If you know me, I wouldn’t need to spell what that is out. Clue: It doesn’t have anything to do with ice cream or chocolate *wink*

But before I relate this part of my adventure, we sidetrack a little first into...

Dramatis Personae

Module GundamX. The module I am assigned to, under a nickname I myself gave. I just thought of giving it a nickname as it feels awkward and a bit impersonal referring to it through phrases such as “the module I am assigned to” or “the module I’m working on”. Much shorter too! I know it’s not as cool as tech products are meant to sound but I’m exerting effort not to have any Freudian slips here.

Project GuitarHero. The project, of which Module GundamX is a part of. Again, a nickname of my own devising, for purposes the same as above.

And lastly,

The Chad Estioco. The awesome author who gives nonsensical names such as Module GundamX or Project GuitarHero. He thinks allĀ alliterationsĀ are awesome and loves ice cream, chocolate, and coding.

Right. That applies for my next few posts as well.

My bad. GuitarHero sure grew a lot while I was Photoshopping UIs. I wonder how large our SVN repository is right now. The first time I checked-out a copy of the project’s files, it has been revised around 800 times already. The most revisions I ever saw on a project prior to this was around a hundred. After 800 revisions, there were already a lot of files and the directory structure was starting to get pretty deep. Scrolling through my workspace in Eclipse feels like watching a tediously-(un)spaced closing credits of a movie whose actors have names like GundamXActivity.java, GuitarHeroConstants.java, etc.

I’m done with one out of the three parts assigned to me. Or, at least, as done as I can possibly get for now. I already have some scratch code for one of the two other parts, and the last one sounds pretty easy and I hope to start and get pretty finished with it before Friday’s presentation.

Some of the base classes I need aren’t fine-tuned yet and I’m still learning how our mentors implemented networking on our project. They used jWebSocket and it is something very new to me; I’ve just grasped the basics of the API our mentors designed.

And, man, the code from our mentors amazes me. I see them use Java constructs I’ve either heard of but never used, or never even knew existed (assertions, anyone?). Even as I sell my programming soul to the minimalist syntax of Python or to the parentheses of Scheme, I realize that I still can’t claim full mastery over Java. Poor me.

Guess that’s it for now. I still need to code. šŸ˜€ ~ The Chad Estioco