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

    • Xdebug is full of awesome
    • Creating a chat bot with PHP and Dbus
    • A year in review: 2011
    • Notes on shell scripting
    • Listening to Dbus signals with PHP
    • Configuring 2 monitors with xrandr
    • A quick note on Dojo’s data grids and dojox.data.HtmlStore
    • Communicating with Pidgin from PHP via D-Bus
    • Upgrading to Fedora 16
    • Contributing to Zend Framework 2
  • Recent Comments

    • Creating a chat bot with PHP and Dbus ~ Robert Basic on Communicating with Pidgin from PHP via D-Bus
    • A year in review: 2011 ~ Robert Basic on Announcing Hex
    • Anon on A quick note on Dojo’s data grids and dojox.data.HtmlStore
    • James on Communicating with Pidgin from PHP via D-Bus
    • A Zend Framework 2 EventManager use case ~ Robert Basic « Bookmarks on A Zend Framework 2 EventManager use case
    • Zend_Auth | Kerek egy ég alatt on Login example with Zend_Auth
    • Jowee on A Zend Framework 2 EventManager use case
    • Jurian Sluiman on A Zend Framework 2 EventManager use case
    • Robert on A Zend Framework 2 EventManager use case
    • Jurian Sluiman on A Zend Framework 2 EventManager use case
  • Tags

    about apache ape blog book comic community conference contributing dbus dojo events example facebook framework hack introduction lamp linux me mysql netbeans open source php pidgin plugin pyqt python random registration review script security setup shell signals site svn talk ubuntu web wordpress xdebug zend zend framework
  • Categories

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

    • January 2012
    • December 2011
    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011
    • May 2011
    • April 2011
    • March 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • 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 — 2012
Design & graphics by: Livia Radvanski — Lady L.
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