• Subscribe to the RSS feed!
  • Subscribe by Email
  • home
  • blog
  • dev
  • Recent Posts

    • Loading custom module plugins
    • Moved
    • I’ll be moving soon…
    • Quick Netbeans tip – task filters
    • Honeypot for Zend Framework
    • Toggler
    • Book review – jQuery 1.3 with PHP
    • 2009 in a few words
    • Bad Firebug!
    • Posterous
  • Recent Comments

    • Robert on Loading custom module plugins
    • Nikola Poša on Loading custom module plugins
    • Jani Hartikainen on Moved
    • Amar on Moved
    • Racinante on I’ll be moving soon…
    • Robert on I’ll be moving soon…
    • rizza on I’ll be moving soon…
    • vranac on I’ll be moving soon…
    • Alex on Online resources for Zend Framework
    • Robert on Online resources for Zend Framework
  • Tags

    about apache blog book comic error example facebook filter framework free freelance freelancing free software introduction jquery lamp licence linux me moving mysql navigation open source pcre php plugin project proprietary python random regexp registration review routing setup site svn trac twitter ubuntu virtualbox web wordpress zend
  • Categories

    • Blablabla
    • Development
    • Free time
    • Places on the web
    • Programming
    • Software
  • Archives

    • July 2010
    • June 2010
    • April 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • August 2009
    • May 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
  • Find me on

    • DZone
    • Google Code
    • Google Reader
    • Last.fm
    • StumbleUpon
    • Twitter
    • Vimeo
  • Friends and Blogs

    • Andrew Taylor
    • Andy Sowards
    • Bojan Pejić
    • Eran Galperin
    • Graham Smith
    • Jani Hartikainen
    • Jasper Tandy
    • Matthew Turland
    • Matthew Weier O’Phinney
    • Miff
    • Miloš Ćuković
    • Nebojša Radović
    • Nemanja Avramović
    • Nemanja Tobić
    • Nikola Krajačić
    • Nikola Plejić
    • Pádraic Brady
    • Rob Allen
    • Swizec Teller
    • Vladimir Stanković
    • WeAreJustCreative
    • Željko Stevanović
  • I use

    • 960 Grid System
    • jQuery
    • Notepad++
    • Subversion
    • Trac
    • Vim
    • Zend Framework

Archive for September, 2008

Smush your images!

by Robert Basic on September 30th, 2008

I just found a nice web site where you can “smush” your images — Smushit.com. SmushIt takes an image and removes all unnecessary information about it: when was it last edited, what image editor was used etc., but keeps the quality of the image! This is more than useful for sites where there are lots of images.

The result of smushing

The result of smushing

There are several ways to provide images to SmushIt:

  • Upload an image
  • Provide an URL to the image
  • Use the Firefox SmushIt add-on

The first two ways are quite obvious; provide an image and it’ll process it in a few seconds.

The Firefox add-on is pretty cool: open up a web page where are the images you want to smush, click the SmushIt add-on icon (it’ll be in the right corner of the status bar), it will take you to their site and process all the images found on your web page.

When the processing is complete, there will be a table showing details about the smushing. Also a download link will be provided, to download the smushed images in one zip file.

Now run little lurker and smush your images :)

Tags: image, optimize, site, web.
Categories: Development, Places on the web.
Comments: 4.

Creative License

by Robert Basic on September 25th, 2008

A few days ago, I wrote about Freelance Freedom, a design related comic by N.C. Winters. Now, he’s here with another comic, called Creative License, which will also be a weekly comic. Since the first number came out on Wednesday, I think all the following numbers will come out on that day. I hope it’s gonna be good as Freelance Freedom :)
Enjoy it, I’m sure I will!

Tags: comic.
Categories: Blablabla, Free time.
Comments: Comments Off.

Facebook registration, part 2

by Robert Basic on September 23rd, 2008

A few days ago I wrote about a problem with registering an account on Facebook. This morning, I’ve got the reply:

Hi Robert,
Welcome to Facebook. We have confirmed your account, and you should be able to access it now. Sorry for the delay!
Login:
New Password:
Please note that Facebook passwords are case sensitive (FACEbook is not the same as facebook). If you’re having trouble with this login/password combination, I suggest copying and pasting the login and password into the appropriate fields.
Once logged in, you can change your password from the “Settings” tab of the Account page. Let me know if you have any further questions.
Thanks for contacting Facebook,
Sadie
User Operations
Facebook

Not a word on what was causing the system to reject my registration. At least, I’ve got one “sorry”.

Well, I have my Facebook account now, so if you’ll excuse me, I’m off to find some long lost friends :)

Tags: facebook, registration.
Categories: Blablabla, Free time.
Comments: Comments Off.

Regular expressions with PHP

by Robert Basic on September 22nd, 2008

I just want to write some real examples. These regexps are (and always will be, ’cause I plan to write several posts on this topic) for the PHP’s PCRE library. Here’s a good PHP PCRE cheat sheet, it’s an excellent resource for regexps. If you know nothing about regexps, first read this Wiki page.

Regexps for <a> tags

A common case is when you have a source of some web page and you want to parse out all the links from it.
An anchor tag goes something like this:

<a href="http://example.com/" title="Some website">Website</a>

Also it can have more attributes, like class, target etc. Knowing how it’s built up, we can start writing a pattern, depending on what we want.
Here are some examples, some explanations are in the comments:

<?php
// Regexp examples for <a> tags

/**
* Different combinations...
* $matches_comb[0] contains the whole <a> tag
* $matches_comb[1] contains what's inside the "href" attribute
* $matches_comb[2] contains what's after <a> and before </a>
* with the "s" modifier mathces <a> tags that are broken in several lines,
* ie. matches <a> tags with newlines
* without the "s" modifier, matches only <a> tags without a newline
*/
preg_match_all(
    '#<a\s.*href=["\'](.*)["\'].*>(.*)</a>#isxU',
    $string,
    $matches_comb
);

/**
* Match only what's inside the href attributes...
*/
preg_match_all(
    '#<a\s.*href=["\'](.*)["\'].*>.*</a>#isxU',
    $string,
    $matches_href
);

/**
* Match only what's inside the href attirbutes,
* only when it starts with http:// and includes http://
* $mathces_href_http[0] contains some trash also, nevermind,
* $mathces_href_http[1] contains exactly what we need
*/
preg_match_all(
    '#<a\s.*href=["\'](http://.*)["\'].*>.*</a>#isxU',
    $string,
    $matches_href_http
);

/**
* Match all Email addresses - mailto:
*/
preg_match_all(
    '#"mailto:(.*)"#',
    $string,
    $matches_emails
);

?>

Play around with these patterns, see what’s for what, experiment, that’s the best way to learn regexps.
Do you have some more regexps for links? Some better ones than these here?
Happy hacking!

Tags: example, pcre, php, regex, regexp.
Categories: Development, Programming.
Comments: None.

Facebook registration

by Robert Basic on September 18th, 2008

I tried to register on Facebook. I filled up the register form, typed all the information, double-checked for errors… Clicked “Sign up”, and they gave me a big read box saying:

Our automated system will not approve this name. If you believe this is an error, please contact us.

Wtf?! My name is wrong?! How could it be wrong?! I checked it again, refilled the form, and… same error again. OK, their system is messed up, I don’t like those troubleshooting systems, those are never helpful, so I’ll try again later. A few minutes after, I tried again. Same thing. Weird. Then I did a Google search on “Robert Basic Facebook” terms. First hit: a Facebook profile for Robert Basic. Yep, there’s a person, with same name as mine, registered on Facebook. So, I used their troubleshoot system, which ended up writing them an E-mail:

Hi there!
I am Robert Basic, from Serbia, age 22.
Well, I’m having trouble registering on Facebook. There is already a guy registered on Facebook, we share the same name, so maybe that’s the problem. Anyway, we are two separate persons, he lives in Germany, I live in Serbia. Is there a solution for this problem? Oh, and the error I got was:
“Our automated system will not approve this name. If you believe this is an error, please contact us.”
So there. I’ve made contact. I come in peace.
Regards,
Robert

The E-mail is sent, now I’m waiting to see what will happen next.

Frankly, I don’t give a damn about having a Facebook profile; well, not anymore. Now, I just want to know, how could this happen? They never thought about this scenario when two persons have same names? OK, maybe, I’m wrong and this error comes up because of something else, but for me, this is the only reasonable explanation.

Tags: error, facebook, registration.
Categories: Blablabla, Free time.
Comments: 4.
12 » Last
Robert Basic © 2008 — 2010
Design & graphics by: Livia Radvanski
Coded by: Robert Basic
Home page last updated on November 30th, 2009.
Frameworks used: Zend Framework, jQuery, 960 Grid System
Blog is powered by Wordpress
Subscribe: Entries — RSS & Comments — RSS