RSS Feed
2012/02/04

Expeditions in the Cloud

Ivo Bathke, 2011/12/17 01:23

Caution: Scepticism ahead!

So i’d like to share some of my experiences in the cloud since i am still trying to figure out if it its worth for me or if i am better suited with an VPS.
Maybe somebody feels like feedbackin.

I tried PHPFog for PHP and no.de by joyent for node.js.
First i have to admit: yes i only tried the free models and of course they are limited and because its free you cant expect to get it all, right?
Yes and thats true.

With PHPFog i set up an app based on symfony 1.4. After some inital problems due to some bugs on PHPFog side, i got it running.
I really like to mention the kind and immediate chat support by PHPFog. It really made me feel like dealin with humans and not only machines. Big up!
By then everything felt really smooth with git deploy, configurations, mysql setup etc.
But i had to shut down the app again, because there are restrictions to PHP which killed the app like disabling “file_get_contents for remote URLS”, probably only in the free model. But that killed it for me at that point.
So read this carefully before going to cloud: http://docs.phpfog.com/index.php/features/article/shared_vs_dedicated
I guess with dedicated hosting you get more power, sure.

» read more

Silex Starter Stubs

Ivo Bathke, 2011/11/04 16:01

There are several preconfigured Silex Apps on github. They let you start your Silex project in no time, which is good.
This makes Silex an even more simple rabbithole into the symfony2 world.

I started one myself and had a close look on the others, so i thought i share this.
They all differ a bit so you must choose what fits your needs the best.

They all follow some kind of “best practise” structure, some more, some less.

» read more

Silex, Twig und HTML5 BoilerPlate

Ivo Bathke, 2011/10/12 07:31

Alright, there is a bundle for H5BP for symfony2 and there is Assetic, you can probably use both with Silex and thats just fine.
But in case you want to keep your Silex project lean (since its micro) you can use Twig and H5BP only and build / deploy your app from the outside.
Boilerplate-300x158 in
With a little tuning of the H5BP build, of course / unfortunatly. (Ok thats the caveat)

So i have a structure like so:
web/
(this is the webroot, here is js/css/images, all that asset stuff and the index, here we use the recommended H5BP stuff’n'structure)
views/
(this is outside of webroot and here are all of the *.twig)
» read more

2 ways to your offline wikipedia

Ivo Bathke, 2011/09/28 10:05

… for whatever reason you might need that ;)

For both ways you will need the dumps, you get them here:
http://dumps.wikimedia.org/dewiki/latest/
The main dump is the pages-articles.xml.bz2 if you want the categories as well, you need the
category.sql.gz and categorylinks.sql.gz too.
The pages file is quite huge and will take you probably about 4 hours to download, depending on your connection.

You will also need a fresh and running installation of the mediawiki software.
Install it and here we go:
» read more

Migrate to Mongolab

Ivo Bathke, 2011/09/26 07:38

Recently i ran into RAM troubles on my vserver for some reasons, i encountered the evil:

Cannot allocate memory at ...

So first i suspected mongodb to use up loads of memory as top showed.

But after some recherche work i learned mongodb only -seems- to use a lot of memory.
see here and here and here
The actual usage was around 20mb RAM, so mongodb was innocent.

The true RAM monsters were some apache and php-fpm zombies, but thats another story.

While suspecting mongodb i thought about outsourcing the mongodb and i found a free and sufficient offer in mongolab.
My interests were on and i gave it a try.
The free version has a limit for up to 240MB storage and since my app is just a small counter it should last for some time.
» read more

nerdpress language switch

admin, 2011/09/16 06:05

As we also have more pageviews from outside germany lately and we’re happy about that,
we have decided to continue posting in english from now on.

» read more

[Symfony 2] Security Bundle: Set User Locale on Form Login

Johannes Heinen, 2011/08/14 12:15

[UPDATE]
A recent update to this article may be found here: http://nerdpress.org/symfony-2-set-default-locale-on-form-login-2/

Das Security Bundle ist ein wenig magisch. Da muss man eine HTML-Form definieren, der Rest wird irgendwie konfiguriert (Namen der Post-Parameter wie “_username”, “_password” etc., den Redirect zum Referrer, Remember-Me Funktion und so weiter, das alles wird von der Firewall intern geregelt. Man muss nur eine Login-Route definieren, einen Stub-Controller + Action-Callable (der aber nie ausgeführt wird, weil die Firefall sich davorhängt), fertig.

Das ist angenehm einfach, solange man keine Fragen stellt. Aber wie führe ich zusätzliche Aktionen direkt nach erfolgtem Login aus, ohne Einfuss auf den Code des Security Bundles zu haben?

» read more

[Symfony 2] Security Bundle – Benutzer mit username oder email anmelden.

Johannes Heinen, 2011/08/12 15:04

Augenscheinlich unterstützt das Security-Module nur die Authentifizierung via Benutzername und Password. Wie man sich mit einem Benutzernamen ODER der E-Mail-Adresse und einem Password authentifiziert, ist ein wenig versteckt. So gehts:

» read more

obsvr.net

Ivo Bathke, 2011/08/02 17:05

Just wanted to mention it here: http://obsvr.net

A media search aggregator build by Me and Max, as the wonderfulwebsolutions.

Its a luckily distributed wolpertinger of symfony, silex, node.js, jquery, isotope, apache and lighty, more to come.

» read more

jQuery .scrollToViewPort()

Max Girkens, 2011/06/11 15:53

yesterday i found this very useful jQuery-script on github:

https://gist.github.com/853841

jQuery.fn.scrollToViewPort = function(animTimeInterval) {
  animTimeInterval = (typeof animTimeInterval == "undefined")?"slow":animTimeInterval;
  return this.each(function(){
    $('html,body').animate({scrollTop: $(this).offset().top},animTimeInterval);
  });
}

it moves the users’ viewport to show the element that it has been called on.

I modified it somehow so that it will check now if the element is already in the viewport.
So we can avoid auto-scrolling in that case.
A offset Parameter has also been added in case we need some margin.

https://gist.github.com/1018842

jQuery.fn.scrollToViewPort = function(options) {
  var animTimeInterval = (typeof options.interval == "undefined")?"slow":animTimeInterval;
  return this.each(function(){
    var offSet = (typeof options.offset == "undefined")? $(this).offset().top : options.offset;
    if( $(this).offset().top <= $(window).scrollTop() || ( $(this).offset().top + $(this).height() ) >= ( $(window).scrollTop() + $(window).height() ) ){
      $('html,body').animate( { scrollTop: offSet }, animTimeInterval );
    }
  });
}

usage:

 $(this).scrollToViewPort( { offset : ( ( $(this).offset().top + my_custom_offset ) - $(window).height() ) } );