Tuesday, February 27, 2007

reformat, the lessons learned.

i reformatted my pc again. and looking back, i've actually learned a lot of lessons from tinkering with the computer:

1.) if it ain't broke, don't fix it. so true, my device drivers were all working fine but then i dropped by the windows update site which listed it had a newer version for my driver(my mouse in particular, i know, who slaps in a driver for his mouse? i do...). so i installed it and the next thing i know, i couldn't get past the loading screen.
solution: safe mode+system restore

2.) who guard the guards? i'm a security freak. i have a firewall, an antivirus program and an anti-spyware up all the time. but aside from that, i've got tons of other anti-spyware/system mechanics/registry editors/optimizers/root kit detectors that they have become the spyware and slowed down my system considerably when i run all of them.
solution: trust in the holy trinity(firewall, antivirus, antispyware)+safe web habits

3.) beauty is high-maintenance. in an effort to tweak my desktop and UI to the fullest, and at the same time easiest, extent, i have gone a little bit too far. far enough that system's overall performance has taken a hit. i have a 256mb graphics card and a full gig of RAM, both of which should be more than enough to run daily tasks smoothly, but it didn't, it lagged consistently especially when opening and closing windows, not to mention it would bring focus to other windows unexpectedly.
solution: stick to the basics(gah, dare i say it?)+trust microsoft's own "enhancers"

4.) too much is too much. let's face it, we want our machines to be all-in-ones. gad, i just realized that wanting that is like being a parent who wants an athletic, smart, popular, good-looking and over-acheiving kid. geez. i slapped on a lot of cards and components on my computer and it got unstable, caused by sometimes incompatible devices.
solution: give your kid a break... errr, disable unneeded and deprecated devices.

5.) one is more than enough. i used to have a lot of browsers. but then, i only really use ie.
solution: just ones.

6.) cherishing keepsakes pays off. i still have files which dates back to about 7 years ago... and its fun to look through them every once in a while. papers dating back to my 3rd year in high school is a source of laughs for me on those boring days.
solution: invest on hard drives

7.) reanimation is no easy feat. i backed up my hard main hard drives, which have all my programs, to the big one which i use as a file repository. now that i've got a clean disk, i want to restore some of those programs(mainly games, hehe) back so i can run them. i don't have the installer discs with me so that means i have to track down each program's files(and temporary files) and registry key entries(i can't just import my old registry, that'll just be a disaster), and copy those to my newly installed os. so far, one program has been reanimated. T_T
solution: have installer discs/have lots of patience

as a reward for reading through my list of reformatting woes, i present you with themes for your pc. i'm sticking to basics this time around so i won't be doing the thing i posted
here. anyway, i found these two themes in the internet, they are from microsoft so all you gotta do is download then double-click them to install! enjoy!

Royal Theme- this is the media center's default glossy theme. when asked where to install it, just leave it at windows to install it in the default themes directory.
Black Royale Theme- black version of the media center theme. its actually a promo theme for zune but it just looks way cool.

and if those aren't enough, somehwere in the bowels of
microsoft.com are hundreds of files which you can actually download for free and use! you just have to find the right way and be patient in navigating it. i got an egyptian and a dog theme there which are absolutely wonderful. i'd post the link but i forgot which page they came from. T_T

...:::more

Thursday, February 22, 2007

aja!

ajax shmajax! here, i will discuss how to create the ajax effect(close to) without the x(xml). ajax stans for Asynchronous Javascript And XML. so... it should technically be just aj, but aja sounds better. =p

why use aja, or ajax for that matter? the answer is, to enhance the user experience and to relieve the server of some load. by using aja[x], you can actually put in more data into a page that has already been served. that way, you don't have to serve the whole page again just to change a single word. and if you are an expert on DOM(Document Object Model), you can, theoretically, just serve a single page and hand it off to aja[x] to get the data then modify the page elements by following the DOM.

i will get to the limitations later on, but for now let's start rolling...

first, lets make the page that's going to be served...

<html>
<head>
<title>AJA!</title>
</head>

those are the mandatory things, here's where you start paying attention...

<body>
<p>This is a demo of aja:<br>
<input id="add" type="button" value="Show lines!" onclick="aja_do('add')">
<input type="button" value="Clear" onclick="aja_do('clear')">

here we have two buttons, what you should take note of is the onclick attribute. once you click on the button, it will execute the code inside the onclick attribute, in this case its a call to a function named "aja_do", passing to it a parameter, either "add" or "clear" depending on what you click.

<div style="border: solid 1px black">
<span id="container">This is where all the magic will happen.</span>
</div>

then we have a div tag, its just to have a pretty box(sort of). inside it, we have a span tag and we gave it an id of "container" and some text in it. the span tag is important (cause of the id attribute) and it must have the id attribute if you want to make your life easier.

<script type="text/javascript">
function aja_do(action) {
var jsel = document.createElement('script');
jsel.type = 'text/javascript';
jsel.src = 'get_text.php?action='+action;
document.body.appendChild(jsel);
}
</script>
</body>
</html>

finally, just before we close the body tag and the document, we sneak in a bit of javascript. yes, you can put script tags outside of the head. but let's concentrate on the script tag and what it holds.

the script tag declares a function. this is the function which the buttons above call when you click them. let's take a look at it line by line:

var jsel = document.createElement('script');

this creates a script tag, DOM style, and assigns the variable jsel to hold it so we can poke it, otherwise, its as good as lost.

jsel.type = 'text/javascript';

then we tell the browser that the script tag we created is text/javascript type, of course, we're using javascript after all.

jsel.src = 'get_text.php?action='+action;

then we tell the browser that the script tag will be loaded from a file and the file can be found there. what's different here is that the source is not the traditional "script.js", as what you'd expect from loading a javascript file. we tell it to load "get_text.php". its been known for a long time that you can load php(or asp, or whatever file you want) files as javascript files or css files(loading a php-fied css file is a quick and easy way to make customizable skin colors for websites), so thats what we're doing now. but the we add to the source some more parameters, namely the "action", which is the parameter which the buttons passed on to aja_do. so we're telling it to load either get_text.php?action=add or get_text.php?action=clear.

document.body.appendChild(jsel);

then we have this final bit which basically "executes" the code inside get_text.php. if you notice i used document.body. that is the reason why i put the script inside the body and not the head. some browsers only append to the body if the script instructing it to append something to it is a direct child. so placing it in the head means its not a direct child anymore, likewise with placing it inside a div tag inside the body. it has to be a direct child of the body, so its convenient to place it just before the closing body tag or right after the opening body tag. though personally, i put my scripts in the head tag and then append the code to a dummy placeholder like a span tag.

so that's your static page, you can save it as aja_test.html. now lets take a look at get_text.php

<?php
$action = trim($_GET['action']);
if(!empty($action)) {
$output_string = '';
?>

the opening section. if you remember we passed what we're going to do, either add or clear, so here we take what we passed and make sure that it is there. we also initialize the variable output_string which will hold what we're going to display.

var con = document.getElementById('container');

then we leave php for a bit to put in a bit of javascript. the only thing you have to remember is that instead of formatting your data in php for html output, your doing it for javascript output, that's why proficiency in DOM is a huge advantage. in this case, we make a variable and use it as something like a pointer to the "container". if you remember, the "container" is in the static page and its a span tag. this allows us to easily to poke that tag whichever way we want.

<?php
if($action == 'add') {
$output_string = "Server time is: ".date("h:i:sa");
?>
var newline = document.createElement('br');
con.appendChild(newline);
var append_text = document.createTextNode('<?php echo $output_string; ?>');
con.appendChild(append_text);
<?php
}

ok, if what we got is add, we put in what we're going to display in output_string, then leave the realm of php and get into javascript. first, we create a newline,so we create a "br" tag DOM style. then we add it inside the container. next we create in javascript the text that we made earlier, and then add it inside the container. and that's it, we have successfully added stuff in the other page! yay!

elseif($action == 'clear') {
$output_string = "Server time when box was reset: ".date("h:i:sa");
?>
while(con.firstChild) con.removeChild(con.firstChild);
var new_text = document.createTextNode('<?php echo $output_string; ?>');
con.appendChild(new_text);
<?php
}

but if we're going to clear, the next block handles it. again, we create the text in php, then enter javascript land. what the first line does is it clears everything inside "container" DOM-style. while container still has a "child" or content, it will remove it. then like the one up there, we create the text in javascript and insert it in the "container". if you take a look at the page, the contents of the box was cleared and just has a single line.

}
?>

then we close the page.

and there you have it, a crash-course in aja and a little DOM. now my example above, if you check it out, absolutely makes no sense. ideally, the php file would do more complicated stuff(read: access database) and return more sensible material. but that will have to do cause i don't have anymore database hosting. if you want to really see it in action, take a look at the gallery from my previous post, thats where my database hosting went.

if you check out my example, you'd notice something is off... namely the time is the same for each line everytime you click a button. is this a bug? nope! well, technically no. this is the effect of your browser caching pages! if you examine the code carefully and take a look at the process from the browser's eye, it looks like we are loading two javascript files: get_text.php?action=add and get_text.php?action=clear. the browser doesn't know its just a single file with different parameters, for the browser, it looks its two different files cause they don't look the same. so, the first time it loads the two files, it makes two different copies in its cache. so the next time you click a button again, it serves the one in its cache, so the time in the line that's added doesn't get updated. and that makes sense cause that is the expected behaviour of a browser.

so you're screaming at me asking why use this at all? the answer is simple, when you do use it, what you're going to use it for will not be anything like my example. in reality, what you will load will be more like file.php?id=1 ... file.php?id=890345 cause you are most likely going to query a database or something. get the picture? although yeah, ajax will not have this problem... =D but this is definitely a lot simpler and easier to implement than ajax(have you met JSON? no? well, he's usually the guy with a SOAP in hand.).

and as a closer, there is this quirk in ie6... it doesn't like loading javascript files dynamically. so sometimes it works, sometimes it doesn't. it depends. if someone could provide more details on this problem and a possible fix, please share it to the world! one odd thing, if you put an alert anywhere inside aja_do, ie6 will execute the code. i'm not sure why, but that's what it does. i've made some headway into this problem, was able to fix it for the avant browser, which is based on the ie6, but it still doesn't seem to work with earlier versions of ie6(either that or my test ie6 is seriously screwed).

see it in action here:
http://fapri.ifastnet.com/aja_test.html
get the files here:
http://fapri.ifastnet.com/aja.zip

what do you think? got a better idea? let the world know! and yeah, one reason i'm writing this is to contribute my little thoughts to the world(erm, google...) which has taught me a lot over the past few months.

...:::more

Wednesday, February 21, 2007

gallery 0.3

in my work, i have to install a photo gallery for some clients. now there are a lot of open source solutions out there and leading the pack, at least for me and what i've encountered as a php developer, is menalto's gallery or simply gallery 2.

now, gallery 2 is a feature-rich solution with a ton of bling-blings and a kicking support/development team. its a great solution. however, as with the nature of my job, i'm asked to deploy a photo gallery in an already built-up website. if you're not already seeing the problem, well the problem is.. gallery 2 puts the photo gallery in the middle of the spotlight. what i need to deploy is somewhere near the balconies.. in short, gallery 2 is nice if you need a website which shows off a ton of photos. otherwise, its an absolute pain to edit to make it fit your needs.. and don't even get me started on trying to edit the templates to the current website's template.

other solutions rely on purely php and file manipulation. while i have nothing against that, the programmer in me just can't swallow the fact that there's no database used. though these solutions tend to look purr-ty...

so for the past projects where i needed to slap in a photo gallery, i built my own photo gallery system. this system is php-based and stores the relevant information in a mysql database, since the websites i work on always have a mysql database anyway and if they don't i create one for them.. hehe, and stores the images in a directory. upon upload, three images are created, a thumbnail-sized image, a default-sized image and the original-sized image. it may take up some more space but your server will definitely thank you when your user uploads 10MP pictures.

over the projects, i got tired of manually editing each line of code to fit the new website i'm going to slap it on. so, i worked on a more generalized version. the result is... gallery 0.3

when you take a look at it, it may not look like much. but if you login as the owner/admin, then you'll see its true capabilities. and developers out there who have to "skin" a lot sites will find that the one page that matters in the gallery is so easy to customize. tags are easy to move around the page and just about everything, from the image sizes to the number of thumbnails to the image used for overlaying some thumbnails can all be customized from the admin page.

however, i'm still not making it available for public release cause there's still work to be done like user groups and permissions. as it is right now, it will work well to serve as a photo gallery for a specific website(or blog... as long as there's only one(or one group) owner). as a photo gallery for the planet? not yet...

and probably the main reason i'm releasing a "preview" is this bug has gotten me stumped... if you're using IE6, head on to the site and you'll find out... i have half a mind to take away "seamless reloading" feature(oh yeah, for most browsers, clicking on a thumbnail won't reload the page) for IE6.

it seems to be caused IE6 not liking loading an additional javascript file dynamically... i use aja, if you're asking why. its ajax without the xml part. more about this in a future post, its a totally awesome way of doing ajax without the additional burden of coding xml.

if you have any idea on a possible workaround for that, PLEASE let me know!

check out the site here:

http://fapri.ifastnet.com/gallery/gallery.php

if you'd like a copy of the gallery, send me a note and i'll send you one. if you're interested in helping me out or just want to check out the code, send me a note as well.

...:::more

Friday, February 16, 2007

there's a grey in e.r.

its official, i'm hooked on grey's anatomy... and i don't care if you say its just a rehashed E.R., there's just something different about it. different in the sense that its almost not like a medical drama...

in fact, its feels a lot like one tree hill, though they might not share the same storyline, plot, character dynamics... i guess what made me say that was how each episode is told. there's something about it which reminds me of OTH, might be because both shows usually start and end with a voice-over from the lead character which speaks undeniable truths. yeah, maybe that's it...

...or maybe the television has finally gotten to me after all those years of having been able to resist its hypnotic, glassy stare. maybe...

...

...or maybe because i just love ellen pompeo...
...maybe...

...:::more

Thursday, February 15, 2007

will you keep me?

this ranks high in my playlist of always played songs...

The World is our Playground and We Will Always be Home
Up Dharma Down

You're my sunshine, and my occasional rain
We become divine after every pain
So won't you please sit this through?
Because everyday we find a reason to stay
If words are too few to keep horizons in view
Will you go or stay and grow?

Standing on the edge between crazy and sense
Remember what I said
Nothing has to end
Won't you think it over?
I'm not so good with words
I don't think you heard me
If words are too few to keep horizons in view
Will you go or stay and grow?

Will you stay?
Will you go
Will you grow with me?

Now that you've found me
Where are we gonna go from here?

I swear I belong, this is where I belong
I swear I belong, this is where I belong
I swear I belong, this is where I belong
I swear I belong, this is where I belong
I swear I belong

Now that you've found me
Where do we go from here?
Now that you've found me

Will you keep me?

ps. thanks to my second-cousin iwi's friend, elyu, at
http://elyu.multiply.com/ for posting the lyrics here.

...:::more

Saturday, February 03, 2007

i'd like you to meet my...

...boyfriend.

for the record, he's my first and only so far.

his name is Race. lol, weird huh? named like that bodyguard guy from johnny quest, if you still remember that cartoon, let's see, i think that guy's name was... race bannon. well, anyway i've got my own race who's gonna look after me now. *kilig*

before we got acquainted, i've been seeing him around a lot of times. here and there, i dunno, i guess it was just a matter of time. fro mthe looks of it, he's pretty popular, a head-turner even, but he just didn't appeal to me back then. i mean he looked like he was a nice guy and everything, a gentlemen, but there just wasn't that oomph-ness which made me go ga-ga over him at first.

it was a cold night when i saw him in an outdoor shop in downtown. i thought to myself, heck why not approach this guy, who i can't seem to shake off, and get to know him. as i got closer, i found myself liking him, more so when we got past after the mandatory exchange of 'how ya doin' and comments on the weather. its like being hit in the head with a bottle, you know? like, why didn't you walk up to him sooner?! after just about a half hour, i was madly hooked on him.

like me, he wasn't born here in america. he is originally from japan but he came here a long time ago. so he's very americanized. i'm still a wee bit taller, but for the most part, we're almost the same height, though he's definitely leaner. we just look perfect together. he's sophisticated, no-nonsense type of guy but absolutely knows how to have fun, and did i mention good-looking? lol...

so after about an hour of hooking up, we became an us. everything was so mutual, like those lines in the movies. 'where have you been all my life?' yeah, everything suddenly had a place in the universe. and i was in heaven.

we went home past midnight, i snuck him into the house, but unfortunately my aunt was still up. long story short, they accepted him. what a surprise, i guess if it really is meant to be, everything will give way. so that night, he moved in with me. hihi. all i can say is, whether you want it fast or slow, he's absolutely awesome to ride. haha. especially in the ups and downs... so positively... uh, next paragraph please... haha

i'm just glad that i took the risk that night and bared my whole heart out for the world to mock. i'm thankful that i did. =)

though he gets a little jealous when i tell him about my other guys, even though there never really was an "us" with those other guys. he's especially jealous of Revs...

and if you're wondering how we look together, here's a pic for the curious: (and yea, i'm putting on pounds... not the currency)



...and if you're disappointed that it wasn't what you thought it was, well... i'm gonna be single for life, remember?! haha... or maybe until thirty, whichever comes first. haha. =p

his full name, by the way, is honda accord. ;-) and yes, we do name our cars, my first was revs(toyota revo) of course, then for about a couple of months here i used neville(pontiac bonneville). my bro has tanya(nissan xterra), and the other cars in our family have names which don't depart that much from their real names. we had a car before, a tamaraw fx, which we named darna, cause they used her in the car's commercials way back in the day, lol. why name your car? apart from its easier to reference, it sort of gives you a certain level of comfort in that you make yourself believe that you understand each other. plus, they're great converstationists(read: listeners) during long drives. race is the first i can truly call my own, and with getting him, i am now a member of the american working class(people who are in debt up to their eyeballs, lol. technically defined as those with a credit report[and score]... lol.).

...:::more

Friday, February 02, 2007

SCARY epic movie

yeah, you read that right. epic movie is the SCARIEST scary movie. and i mean that in a bad way.

there's this trend in the whole scary movie franchise wherein they try to outdo the previous film's shortness, while i'm not sure if this if rom the same guys who brought us scary movie, epic movie definitely took up the challenge. it probably just clocks in at an hour. and that is probably the longest hour you'll ever spend in a movie theater. its like, you want the hour to be over just to get out.

the humor is way too over the top, its too lame that its not making people laugh anymore. and in a theater packed with americans, that's saying a lot(no offense to americans, but really, chicken-cross-road really is your sort of humor. and i enjoy that type of humor, though i like british humor more).

perhaps the only people who will enjoy this are the movie buffs(who call themselves that but in reality have only watched a couple of films in their life and read about the rest of what they know in the internet) who loves testing their movie trivia. but for me, it falls waaay short of it being a challenge. its like a big chunk of narnia held together by a lot of pieces from other movies.

the only way you'd get to enjoy this movie is if you download it over the internet, and have a couple of beers before hitting the play button. heck, if i did that, then this review might have turned out a little better.
anyway, i've got a really special post coming up... =D

...:::more