CSS

March 8, 2010 | Filed Under a Web Developer's Diary, techy | Leave a Comment 

I didn’t learn CSS in school but it’s one of my favorite tasks to work with. A lot of my co-workers don’t like working with the UI so I normally get that very exciting task :D . (It can get frustrating at times [read: IE7] but still.. )

Anyhoo.. today, I am working on a new project that I’m really excited about. There’s this template system that really frustrated me almost 3 years ago. And today, we’re using it again. :) Yip yip.. I am actually excited to re-learn those stuff..

So, here’s a rundown of the stuff I learned for our “Web Developer’s Diary” series:
1. Be excited about learning new stuff. Let’s face it.. we went into a career that is going to change and update itself every single second. And that isn’t a bad thing. If you’re a web developer.. expect to learn new stuff along the way. If you’re a recent graduate.. please know that not everything you’ve learned in school will make it to your “day to day work” lives..

and

2. “Minimum is the new Max”. :) haha! I just came up with that line. What I’m trying to say is.. if you’ll be working on the UI.. do not clutter your html page with lots and lots and lots elements when you can achieve the same effect with few elements. Remember that template system I was talking about? Its’ css file is as big as 94,000 .. I removed unnecessary stuff and shrinked it to 80,000 .. not much right? hehe.. but if I get a $ for each byte I saved I can so buy that car I’ve been wanting.. hahaha! The point is ladies and gentlemen.. “keep it short”. There’s a handful of articles talking about shorthand css.. and believe it or not.. those are really, really useful!

I’ll go ahead and give you few examples:
1. 0px can also be just 0
2. #FFFFFF can also be just #FFF
3. spaces between the : and { can also be removed :)

hehe.. those are the only stuff I can think of at the moment.. but it saved me 14,000 bytes.. it might save you a lot too..

’til our next chika! :)



fb:multi-friend-selector and fb:comments bug

March 4, 2010 | Filed Under a Web Developer's Diary, techy | Leave a Comment 

If you have fb:comments and fb:multi-friend-selector both on one page.. you’ll notice that  the fb:multi-friend-selector doesn’t work right. You’ll see the this.form is null error from firebug. No one ever gets selected even when they look like they’re selected.

To make this work.. add the fb:multi-friend-selector to a fb:js-string variable. Next, on your javascript.. add that variable to your multi-friend-selector’s container. :D

I guess what I’m trying to say is that you add fb:multi-friend-selector using js.. Pretty easy right?

Note: Today is 04 March 2010. Since facebook changes a lot.. this might not be true in the future. But I wrote this for those who are scratching their heads trying to figure out why “this.form is null”.. hehehe! I feel you. :)



Web Dev’s Diary #1

January 29, 2010 | Filed Under a Web Developer's Diary, techy | Leave a Comment 

Dear Diary,

:)

Today, I encountered this thing that my co-worker named as “WSD (or White Screen of Death)”. I normally get it because I’m on a strict environment. The very first time I got it, I was really, really, really REALLY scared. I thought I broke something. I know I did break something. :) It turned out, there was just an error that needs fixing that’s why it’s giving me a whole screen of pure white-ness :p. I know I sound like errors don’t scare me that much anymore. Well, time (and days filled with WSD) has taught me something.

Don’t panic. Panicking really won’t help. Believe me. Next, search for the small things you might have missed. 95% of my WSD encounters were caused by {[(;)]} –characters I learned to love and hate. If not, there’s always google.

-vaL



Permalinks

September 2, 2009 | Filed Under techy | Leave a Comment 

As you might have noticed, my blog is powered by ‘wordpress’. :) Aside from the fact that I have this office mate, aice, who have this really cute red wordpress tshirt — [I so have a crush on her tshirt btw!], I especially love wordpress and wordpress’ permalinks. Today, I was trying to copy that.. unfortunately, I got tired of tracing the wordpress code for that particular function.. so instead, I’m going to share what I have so far:

$url = preg_replace('/[^a-z 0-9]+/i','',strtolower($url));
$url = str_replace(' ','-',trim($url));

where $url is your post title. (It took me forever to get that.. so I thought someone might need it someday.. :D )



php’s array_search

July 9, 2009 | Filed Under techy | Leave a Comment 

Hello pipz! :) Yipz, I am on a small break because I just figured something out.. hehehe..

So, I was working on an “also commented on [item]” task, and came across an interesting function. If you’re wondering what “also commented on[item]” is, you can check your facebook notifications, and you can sometimes see notifications like “[friend name] also commented [post_owner]’s status”. This is a very special part of facebook that reminds you of a discussion you kind of checked out.

Read more



Project 365 – Day 48: “CNAP”

July 9, 2009 | Filed Under project365, techy | Leave a Comment 

My CNAP modules after three years.. hehehehe.. :)

CNAP is one of the hardest subjects I had in College. CNAP stands for Cisco Networking Academy Program. :) techy right? :D hehehe.. well, I did came from one of the best courses in MPSC (now MUST -Mindanao University for Science and Technology). Because we really can’t afford to buy super expensive books (for CNAP), we have them printed for Php 2.00 per page.(And the cover you see here is from Grasya’s creative minds.. hehehehe)

I was actually searching for something that’s why I took it out. My bestfriend was asking me how you get the IP Addresses.. Well, if you ever wonder why your private networks normally starts with 192.168.blah.blah .. my answer would be “RFC 1918″. Here’s a link. Basically, it’s a law that dictates routers not to route Private addresses (so, that’s why we use 192.168.blah.blah as our IP Addresses because we’re then sure that it won’t be routed to the public).

(But that is from my blurry CNAP days (which I must repeat was 3 years ago…) so, forgive me if i’m wrong.. hehehehe)



Google API for Image Search

July 2, 2009 | Filed Under techy | Leave a Comment 

Remember how I said that the api sometimes returns a non-existent url? (Maybe because that url can be really, really old).. The tentative solution was to add a spinning wheel as a background for that image. But today, I decided to find a better solution..

try{
      $img = @file_get_contents($r->url);
}catch(Exception $e){
      $img = '';
}
if(!$img){
      continue;   
}

This just basically means that when file_get_contents fails, do not include that image url.

Update: I found a better function, instead of file_get_contents, try using: @GetImageSize.



Google’s Autocomplete

June 24, 2009 | Filed Under techy | 1 Comment 

Google is one of the leading giants there is in the IT world. And one of the things I really like about google is google’s auto complete. It’s their own way of trying to predict what you were trying to search for. Example, you type in ‘one’.. on my search, it tried to suggest words like “one tree hill, onemorelevel, onet, one guy one cup, one life to live, one step ahead, one tree hill quotes and so on…”.

So, I’m gonna share my code on how I got google’s suggestions based on a term.. (ofcourse, this is written in PHP.. :D )

if($_REQUEST['q']){
$term = $_REQUEST['q']?$_REQUEST['q']:'google';
$tgNm = 'CompleteSuggestion';
$url = 'http://google.com/complete/search?output=toolbar&q='
        try{
            $objDOM = new DOMDocument();
            $objDOM->load($url.$term); //make sure path is correct
            $suggestions = $objDOM->getElementsByTagName($tgNm);
            foreach( $suggestions as $s){
                $details = $s->getElementsByTagName("suggestion");
                $data = $details->item(0)->getAttribute('data');
                if($data){
                    $return[] = $data;
                }
            }
        }catch(Exception $e){
            echo $e;
        }
    }

where $_REQUEST['q'] is your magical term :D

Pretty simple right?



FB Gotcha #1

June 23, 2009 | Filed Under techy | 2 Comments 

Last week, I had one particular problem that was a little too hard for me. You see, I was trying to show 15 images (from google’s api) when you key in a particular word. But, I later found out that the images from google’s api are not really 100% complete.. meaning, some of them doesn’t exist anymore, which in turn will give us an empty <img> element. I don’t particularly like this because it kind of ruins the design. I really didn’t mind until my boss asked for a spinner wheel while the image is being loaded. A spinner wheel is just an image that web developers use to show that in the background, something is going on. (Something along the line of “Don’t worry, we’re trying to do something”). That can’t be too hard right? But, in Facebook’s javascript, a lot of things is hard.. like trying to figure out if the image is already loaded.. yipz, we can’t know that an image is already loaded, unless you try to check it every few seconds if an image have a height/weight.. but remember that their are browser issues when it comes to height/weight.

So, here’s what I did, I added that spinner wheel as a background for that image, added a min-height and min-width so that the spinner wheel will still show up even when the image return false. Pretty simple right? You’ve gotta love css :D



Just when I thought

June 12, 2009 | Filed Under techy | Leave a Comment 

I was over you. j/k ..

Just when I thought Facebook’s Batching doesn’t work for me, I looked closer and found the problem..

$api_client = $facebook->api_client;
$api_client->begin_batch();
$friends = & $api_client->friends_get();
$notifications = & $api_client->notifications_get();
$api_client->end_batch();

See, there’s this small yet tooo important ‘&’ sign. (I didn’t know without it batching won’t work :/ )

hehehhee..



Next Page →