15
Aug 10

WP-Contact Form conflicts with Media Uploader

I used to host this blog on a lowly shared hosting with a very restricted disk space that I relied on offsite image hosting services making me not aware of any improvements on media management inside the WordPress admin until today. I kept on getting the annoying popup giving me no way to upload an image. A few google search later, the only solution was to deactivate all my plugins and re-activating them one by one. Surely enough, with no plugins activated, the media uploader works so it’s not a folder or file permission. I did this until it stopped working again.

WP-Contact Form was the culprit and I’m a bit surprised. It has worked extremely well for me. I was using WP Contact Form ever since I started using wordpress when it’s was still written solely by Ryan Duff.

I’ve deactivated the plugin and didn’t bother to look for a replacement since I’m not using a contact form anymore because of the level of spam it brings me everyday.


15
Aug 10

Pinboard.in Facebook App

A week ago, I was so bored I decided learn something new. I was browsing my Pinboard.in bookmarks on a lazy saturday morning and checking on my facebook account for new interesting things my friends are sharing. So I thought what if I’ll embellish my facebook profile with my recent pinboard bookmarks. Then I started pounding my laptop keys.

I haven’t really tried writing a facebook app. I wrote server side clients that connects to their Social Graph API but not applications that are embedded and utilized facebook UI API such as FBML. I took the challenge.

My Pinboard Links was written in an afternoon. It does not do much than giving you a way to put your recent pinboard.in bookmarks in your facebook profile tab. Server side is powered by Kay Framework and Google Appengine.

Much of the hard stuff is figuring out the facebook FBML documentation. Documentation site looks good but it’s a mess. It wasn’t clear to me at first the difference between using FBML or iFrame. It doesn’t explain well what this or that function does.

Anyway, I had fun doing it. This is the best thing being a programmer. I get to write stuff for myself.


24
Jul 10

Megan

Megan Trinity

Megan Trinity. She was born last July 10, 2010.


27
Dec 09

2009: looking back

i wish i have something to write about 2009. it could’ve been a great year for some. it wasn’t for me. i have lost a lot this year. money, hair, weight… some i cannot quantify.

all i have are a few unfinished projects and some unimplemented ideas. i feel like i lost my passion for programming save for learning new technologies. building software? not so much.

i lost my love for photography. knowing that software can trump whatever my camera churns out doesn’t help. photography as i know it ceased to be. at least in my circle.

i lost some blogs. what used to be a good idea – or so it seems in the middle of the night – is now such a crap i can’t even begin to think about. actually, lost half of made-for-adsense blogs i can no longer maintain.

also, i lost something i never had.

i will be marching to the new year with a new set of goals. hopefully, i will have more success in the coming year so i won’t feel like such a lulz.

clock says 3:45AM. guess it’s time to sleep.


13
Aug 09

ruby-like syntax for javascript array functions

At work, we recently decided to use YUI (Yahoo UI) to generate our user interface. YUI is great. It got almost all the widgets we need. Tabs, tree, carousel... As a result, we have consistent look all throughout. We dump the javascript framework that came with Ruby on Rails and use YUI instead.

Now, here's the problem. If you've use prototype or jQuery, you must be used to using the utility functions these frameworks provide. I go big on jQuery's each function for iterating through arrays and array-like object. Unfortunately, YUI - in version 2.x, at least - does not provide these array functions.

In a course of an hour, I wrote a handy set of functions to get me through. It could've been easier if I just include jQuery since the noConflict function makes it work with any js framework but then I got a mandate to focus on YUI.

JavaScript:
  1. Array.each = function(a, fn){
  2.     for(var i=0; i <a.length; i++){
  3.         fn(a[i]);
  4.     }
  5. };
  6.  
  7. Array.prototype.each = function(fn){
  8.     Array.each(this,fn);
  9. };
  10.  
  11. Array.collect = function(a, fn){
  12.     var new_array = new Array();
  13.     a.each(function(e){
  14.         new_array.push(fn(e));
  15.     });
  16.     return new_array;
  17. };
  18.  
  19. Array.prototype.collect = function(fn){
  20.     return Array.collect(this, fn);
  21. };
  22.  
  23. Array.inject = function(a, init, fn){
  24.     a.each(function(e){
  25.         init = fn(init, e)
  26.     });
  27.     return init;
  28. };
  29.  
  30. Array.prototype.inject = function(init, fn){
  31.     return Array.inject(this, init, fn);
  32. };
  33.  
  34. Array.detect = function(a, fn){
  35.     for(var i=0; i <a.length; i++){
  36.         if(fn(a[i])){
  37.             return a[i];
  38.         }
  39.     }
  40. };
  41.  
  42. Array.prototype.detect = function(fn){
  43.     return Array.detect(this, fn);
  44. };
  45.  
  46. Array.select = function(a, fn){
  47.     var new_array = new Array();
  48.     a.each(function(e){
  49.         if(fn(e)){
  50.             new_array.push(e);
  51.         }
  52.     });
  53.     return new_array;
  54. };
  55.  
  56. Array.prototype.select = function(fn){
  57.     return Array.select(this, fn);
  58. };
  59.  
  60. Array.reject = function(a, fn){
  61.     return a.select(function(e){
  62.         return (!fn(e));   
  63.     });
  64. };
  65.  
  66. Array.prototype.reject = function(fn){
  67.     return Array.reject(this,fn);
  68. };
  69.  
  70. Array.reduce = Array.inject;
  71. Array.prototype.reduce = Array.prototype.inject;
  72. Array.map = Array.collect;
  73. Array.prototype.map = Array.prototype.collect;

Use it like:

JavaScript:
  1. >>> var a = [1,2,3,4];
  2. >>> a.reduce(0, function(x,y){ return (x+y); });
  3. >>> 10

Basically, almost all functions are built on top of Array.each so I'm not sure how fast it'll go.

Happy hacking.


21
Jun 09

updated sideblog for WP 2.8

In the process of committing updated code for WP 2.8 to wordpress subversion repository. Due to changes in rendering multiple widgets, version 6.0 of Sideblog breaks backward compatibility. Additional work can be done to make it so but in the meantime to address the needs of those who have already upgraded their wordpress to 2.8, this version will suffice.

To upgrade, I suggest deactivating the plugin and go through the usual installation process. I have not thoroughly tested (as usual) the code, so any bugs please leave a comment.

Get Sideblog version 6.0 here


12
Apr 09

url shortener using base 62

Trying to scratch an itch one weekend, I tried to write my own URL shortener service. After all, bit.ly got $2M funding for offering such service so I went ahead and see how hard it is to create one. If you've been doing web development for sometime, this activity is trivial. The only hurdle I have was how to generate those random looking string appended at the end of the domain url. For the lazy there's always Base36 that look like the one tinyurl is using. I wanted mine to resemble is.gd so I wrote my own. Here's one I quickly wrote in ruby.

RUBY:
  1. class B62
  2.   CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split('')
  3.   BASE = 62
  4.   def self.encode(value)
  5.     s = []
  6.     while value >= BASE
  7.       value, rem = value.divmod(BASE)
  8.       s << CHARS[rem]
  9.     end
  10.     s << CHARS[value]
  11.     s.reverse.to_s
  12.   end
  13.    
  14.   def self.decode(str)
  15.     str = str.split('').reverse
  16.     total = 0
  17.     str.each_with_index do |v,k|
  18.       total += (CHARS.index(v) * (BASE ** k))
  19.     end
  20.     total
  21.   end
  22. end

Hope that helps.


22
Feb 09

Photos from the Red Dot Museum

doorway

sale stuff

I lost my DSLR last christmas vacation in the Philippines so I have to make do with my film cameras. These photo was taken on a lazy sunday afternoon at Red Dot Design Museum. They're having their once a month art market where they sell art-sy stuff. After developing these and the other rolls of film from mid last year, I feel like I won't miss much of my DSLR. I've been shooting on the widest angle most of the time.


28
Jan 09

Bride at the Door

bride at the door

A silhouette of a lovely bride taken during wedding of my college best buddy in Manila. I was supposed to shoot digital until the letter of invitation arrived. I'm going to play a minor part in the wedding ceremony which would prevent me from lugging a big-ish camera around.

Not owning a digital point-and-shoot, I happily took the Olympus Trip with me. Shot 2 rolls of Lucky Film 100 New which proved to be a disaster. The Luckies was for the sunny beaches I'm going to visit after the event. None of the shops I visited carried my favorite Tri-X or any standard BW film. The Luckies have no match against low light inside the church.

Lesson learned: do not expect to find film at your destination.


24
Aug 08

lomo effect

sailboats

I haven't tried lomography and probably won't any time soon. This photo was not taken with a lomo camera. I took it using my D40. This was an uninteresting photo straight out of the camera. I was playing with the effects in iPhoto when I notice it looked a lot like the lomo photos I saw in flickr and zooomr.

Gear: Nikon D40, Nikkor 18-200mm f3.5-5.8 VR, iPhoto