Sending invalid Unicode via socket.io

Well you can try to, but it will end up almost probably in an disconnect which is caused by the browser.
As i have learned here.

Given you have a string which contains invalid unicode like:


This will trouble the browser and the socket connection.

If you prepare your json with PHP and  json_encode the Unicode will be escaped to some strings like these:

\ud83d\ude31\ud83d\ude31\ud83d\ude04\ud83d\ude04\ud83d\udc9c\ud83d\udc9c\ud83d\udc4a

But on clientside it will still result in invalid Unicode.
Continue reading “Sending invalid Unicode via socket.io”

OXID eshop routing

If you wonder about routing in OXID eshops or how the URL structure is here are some hints:

OXIDs MVC, well thats some kind of different naming and you have to get used to:

the M (Model) you find in /core
the V you find in in your templates in /out, there the main view is called the same as your controller, given the controller has a render() method.
/views/details => /out/[templatename]/page/details.tpl
the C (Controller) you find in /views (what? oyerywell!)
like /views/details.php

The routing itself is like so:
Continue reading “OXID eshop routing”

Silex Starter Stubs

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.

Continue reading “Silex Starter Stubs”

tell redis db to not persist

redis persists its memory data in snapshot style in every n seconds depending on your configuration.
read more here.
perhaps you would like to use redis as a pure in-memory db, like f.e. memchache.
you can tell redis to not persist and save some bits&miliseconds.
this could be the case when using redis as a f.e. realtime queue, you wont need persistence,
because you could say: nobody needs is newsfeed from the that day before the machine crashed ;)

alright, do so by:
Continue reading “tell redis db to not persist”

Symfony 2 – Set Default Locale On Form Login #2

A small update/correction out of sequence:

A few weeks ago i described how to hook into the form login process in order to change the user session´s locale.

In the meantime a non backwards compatible code modification has been introduced that outdated this article. From now on (Symfony 2.0.4) the locale and default locale settings are maintained within the request object (and not as used to be in the session).

So, here is a little update – under reserve – because the locale setting´s logic will probably change again in the future.

Continue reading “Symfony 2 – Set Default Locale On Form Login #2”

Silex, Twig und HTML5 BoilerPlate

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.

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)
Continue reading “Silex, Twig und HTML5 BoilerPlate”