Perl, a forgotten language?

| | Comments (0) | TrackBacks (0)

I haven't seen much activity about PERL in freelancing. In fact everyone have kind of forgotten this powerful language, specially in text processing. Today I started glancing at a PERL book my teacher had on the shelf. I felt a bit awkward because, well, I've always hated PERL's syntax, it wasn't something I classified as a "logical syntax"(for example, Java's syntax are pretty self-defined), but the more I read-I found myself thinking "whoa, everything I could do for manipulating text is here".

The one thing I love the most is regular expressions in PERL. It doesn't feel bloated or hard to write the code. It's purely straight to the point. One of these days I'll probably manage to learn PERL. Well, manage isn't exactly the word. Learning the syntax and built-in functions is what I mean.

Anyway, I'll be toying with it pretty soon (probably next week). I still have to take a deep look at C++/C/C# for a change. It's something I have been avoiding from the very start because I don't want to confuse myself right now.

Progress in Java

| | Comments (0) | TrackBacks (0)

After starting with Java I asked my teacher if she could lend me her Java book, Java How to Program, published in 1999. It's a bit outdated and I knew it will give me problems. Yet, sometimes old books cover more about subjects like OOP, OBP. Polymorphism and other programming terms because they were slightly new to developers.

I've been researching about games made in Java, to my surprise no one has created a real game, and when I mean a real game I'm talking about things like "Call of Duty 2", "Final Fantasy 7". Gaming in Java has been deserted for unknown reasons. My current goal is to break the myth of "you can't program games in Java" due to "resources hog" and many other things.

Well, let's see the outcome of this, maybe it will turn just fine.

Opera + You

| | Comments (0) | TrackBacks (0)
Opera 9.6 - Making you faster

I'm pretty much happy today I'm making my switch to Opera Browser. Mind you, Firefox has been quite slow and while their plug-ins are awesome I don't really do much nor need many plug-ins. Of course, as a firefox user (if anyone here reading this) you might feel offended and try to back it up. I've been looking foward to use Opera for quite some time, and the only thing that stopped me was not having ad-block which I finally found the solution today.

Mouse Gestures in Opera is also something to be amazed, you just don't know how helpful they are until you get the hang of it and use them. I'm still learning the gestures and well takes a bit of time to get used to.

Another reason I moved to Opera was because of their interface. I've really grown tired of Firefox interface, there is just something there that doesn't makes me feel there is something wrong.

I'll probably keep using Opera no matter what other people say, it's something I have been eager to do since I reformatted this computer. I really can't live without adblock, due to many sites cluttering the web pages with stupid ads. (Ignores mine)

If you are interested, give it a try, and not one of those that lasts 30 minutes and start trolling. Cheers!

Google Chrome (Chromium)

| | Comments (0) | TrackBacks (0)

There has been quite a fuss about the new browser Google released, Google Chrome (Chromium). I wasn't that eager to ditch my firefox, and as far as I've used Chrome, there is no way I'll ditch my current web browser. Obviously because I can't live without Adblock Plus, Web Developer, Stumble Upon plug-ins.

How much I yearn Google Chrome to have those plug-ins. I would make the switch fast, of course the only reason I have, the interface. I can't help but to love and embrace the simply yet usable interface. Chrome comes with spell checker, somehow I feel it's quite faster than Firefox's one but I'll leave one to those who benchmark a lot since I have no interest in that kind of information at the moment.

I'm awed by the launching speed of this browser, it opens almost instantly, perhaps because I don't have plug-ins here but I doubt it makes a difference, why? I have used firefox with no plug-ins and its launching speed has always been slow.

Now something I caught from gossip is the "incognito" window, or "porn mode", of course calling it porn mode is stupid, just because tons of teens, kiddos (and shameless married men) are going to watch porn using incognito mode doesn't mean it's just for porn. For example you work for a company and you happen to be always online on the company's rival site because of whatever reason. Close incognito and nothing ever happened. Anyway, yes, now Firefox 3.1 will have this feature, although was this planned or did they just did it out of desperation? (To not lose their % in the browser share)

There is also the Yahoo! Dropdown in google main site. Something I have found is that keywords like "sex", "hardcore" does not appear in the dropdown (as you see in the screenshot) so at least we have an idea what google blacklists from the search results. googlechrome01.png googlechrome02.png The release is still not mature enough. I really miss the privacy settings, and smooth scrolling. (Yes, I realize this is a beta)

Java + Me

| | Comments (0) | TrackBacks (0)

It's been several weeks since my last post. I can't deny that I've been busy with college and it's been a nice time too. I've given my first presentation to the class and I plan to give my second relating to object-oriented. Of course, my knowledge of OOP is limited as most of what I've learned were theories and how it worked, the concept itself is easy to understand, writing and producing isn't the easiest part.

I'm introducing myself to Java, now with the help of my professor (she's a Java freak) I plan to take advantage of that and learn Java to some extend. There are quite lots of questions, as an starter I can't help but to think of a dozen of questions.

Ah yes, my first presentation was about logic operators, arithmetic in programming and most of the basic fundamentals a programming language provides (IF/ELSE/THEN/WHEN) etc etc. I used PHP on this, with the hopes to move to another language. Mind you, it's really hard for me to leave PHP.

Anyway! That aside, me got a Wii!

I was given today a little project, as a freelancer sometimes you have to prepare for the unthinkable even though their title begs to differ. I mean today it's been a spacey day, wasn't that bad since I learned something too.

So, you must be wondering what happened? If you are a developer, imagine 3,000+ \r\n invading the HTML source code. Plus different \r\n with 3,4,6 spaces, obvious the designer who did the layout surely like to annoy others. \r is carriage return while \n is newline, windows style, I think.

What does this do? Nothing, you can't see it when you are displaying the HTML, but if you check the source code then you notice big spaces and carriage returns.

Solution? My solution is pretty straight foward, yet it lacks efficency.

In the PHP you must get the HTML in a variable.

Then to remove the excessiveness our smart designer added:

$regex = preg_replace('{^[^>]([\r\n])?( | )?([\r\n]+)$}mx','',$html);
$regex = preg_replace('#([ ]+[\r\n][\r\n])#x','',$regex);
$regex = preg_replace('#(([\r\n]{3,}|[\r\n]{4,})([\r\n]+))#x','
',$regex);

I started by telling the regex engine to replace after > is set, search for possible returns and newlines is there are any present, search 3 spaces OR 1 space, optinally. Search for one or many \r\n and replace them with nothing.

Later on the second preg_replace, check for one or many spaces followed by two /r/n

And lastly, search 3 /r/n OR 4 /r/n to unlimited, followed by one /r/n+ and remove them.

I think I could have done better, but since deadlines are not something you can negotiate with--well, you get the idea. This got it done and that's all it matters. Luckily, I compared the line numbers, the original file had 4312 lines and the modified one ended with 313 lines.

Break Brains

Cheers

Lights out

| | Comments (0) | TrackBacks (0)

Today it was the first power outage that took around six hours to fix. I was alone with my big brother and sister at home, our parents are already working since their vacation ended a week ago, we can't help but to wait for our time to resume our studies. Someone like me who has been sitting on the chair "daily" knows it's a bit weird to go outside. It wasn't bad, infact if it happens again I wouldn't mind either. Today there was something I missed that have kept me thoughtful through this unforseen day.

When someone starts doing a chore, or an action that is repetitive, we tend to give all our attention. Our lifes are now "intertwined" with technology. We sit in front this computer, chat, blog, play, make dramatic events, argue, insult and laugh. The distraction it creates is so much we forget our surroundings, most of the time we forget the little details that keeps the family together. It is sad.

What has happened to our old lives? Most of our time we spent the sitting in front of a ridiculous virtual world. What about this mundane world? We have let ourselves flashes and metal take the social status of everything.

These six hours gave me the chance to take ahold of what was broken to pieces. We sat down. At first we just stared at the walls and our minds mumbling innerly "when will the electricty come back". Thirty minutes passed, we started talking of what have happened lately and chit chat for hours.

Hours passed in a blink of an eye, and I realized that it was wrong to condemn something that has never happened. It didn't matter anymore, the realization today has left me wordless, to the point that If I was going to condemn someone it would be my lack of words to be spoken.

The hardest part for me is constructing a bridge to communitcate again. I can't believe I have missed this, as I am an observant person. I tend to attempt to breakthrough possible problems before they happen, yet I feel powerless since the lack of communication has caused so much damage over the years. I wouldn't know what to say, and I can't proudly say "Hey, I know what went wrong!"

videoCast PHP Parser

| | Comments (0) | TrackBacks (0)

Well, here I am again, with a working parser that might be helpful for your development, especially if you are looking for a youtube link parser.

What is this?

videoCast PHP Parser is a pretty simple class that helps you parse links like http://vimeo.com/613460 into an embedded HTML. It supports Youtube, Dailymotion (permalinks only), Metacafe, Revver and vimeo.

How to use?

This is the easy part. Upload the parser to your site and in your php file.

require_once 'viCastPHP.php';

$parseVideos = new viCastPHP();
$parseVideos->getFormat($_POST['text']); // You will need to change this and adapt it to your needs

Another way of using this parser is

$parseVideos->limitParse(3)->excludeSites(array('youtube','metacafe'))->getFormat($_POST);
or
$parseVideos->limitParse(3)->getFormat($_POST);

getFormat must be called last for it to take effect of the changes.

excludeSites() only accepts arrays or a plain string.Right now the strings you may put in the array or string are only: "youtube","dailymotion","revver","vimeo","metacafe".

limitParse() only limits # for each pattern. (I'm thinking of extending this but that depends now)

What was this for?

I created this for learning purpose for both PHP5 OOP and Regular Expressions. I thought I'd share it with you guys :).

Get the parser NOW!

Yesterday out of boredom I started playing with Regex (Regular Expressions). I somehow got carried away and found that regex is actually fun once you learn it. It's like playing chess, all the strategy you have to do to match and process your text is part of winning over content.

Well, what I did is pretty little, that is converting plain urls like

http://www.youtube.com/watch?v=PF-cXjxgREQ

To

It also supports links with http://au.youtube.com/watch?v=PF-cXjxgREQ and so on. Of course youtube alone wasn't enough so I threw at it Metacafe, revver, dailymotion, vimeo support.

Of course, an issue came up with dailymotion, that is the way the "categorize", so the URL is affected and it only works with Permalinks. I'm currently working on a fix that might actually fix the redundancy of "/section/section/section/".

Try the parser, live!
Paste links like

http://www.youtube.com/watch?v=pkuLh4u0H8E
http://www.dailymotion.com/video/x5qbhc_99-dreams_shortfilms
http://www.metacafe.com/watch/1269694/trick_shot_masters/
http://revver.com/video/1076971/sexy-fitness-break-tight-glutes/
http://vimeo.com/707539

Paste them inside the textarea :) (of course!) Anyway, this will be available under New BSD License as soon as I finish a few things.

I'm still new at regex! Can't wait to master it soon :)

Digg.com phailing?

| | Comments (0) | TrackBacks (0)

It's been a while since I visited digg.com. I don't know why but I get this feeling that it's being overrun by 12-17 year old kiddos submitting silly stuff. Sadly it somehow ends up in the front page, so digg is kinda becoming the next 4chan which is actually the most horrible thing that can happen besides hearing that Kevin Rose is getting a sex change (of course this is just a rumor! err).

Anyway, going back to topic, as if there's any, this is a damn blog (a.k.a: weblog, diary, net diary, a system used to vent about the government and how much they hate it, not limited to personal attacks) . Furthermore, Root of All Evil has enlightened me on how much does blogging actually sucks.

Wait, what wasn't that topic but here we go again! Now that's digg.com phailing hard I wonder where I'm going to get my daily fix of interesting articles/sites and not an endless loop of

Politics
Memes
Something photoshopped
Britney
Idiots pasting memes
Hollywood idols...
Batman..

I think I'm just going to take a break and read a book...