Category Archives: DevTips

Running Drupal inside Symfony Framework

Yay! I managed to boot both Drupal 8 and Symfony Framework bundle in one Symfony setup. If you look at the screenshot closely, you will see Symfony Profile toolbar inside a Drupal setup.

The original idea is from Theodo, you use a bundle to bridge the between Drupal and Symfony, using EventListener to intercept the request and route to Drupal core if Symfony does not handle it.

So to run Drupal inside Symfony, first you need to start a new symfony application. Just follow the tutorial on the website.

Then you need to adjust the composer.json to include Drupal, and explicitly state the dependencies. At this time, you will have to use Symfony 2.4 or Composer will refuses to checkout due to dependencies conflict. Here is my composer.json. Make sure to run composer update  after that, it will takes a while to download all the dependencies.

Once all the dependencies are installed. Checkout or Download TheodoDrupal8Bundle to src. I have forked the origin repository and adjust some change to support core/install.php request. Since Drupal 8 also coming with it own vendor, you will need to modify vendor/drupal/drupal/core/vendor/composer/autoload_files.php and comment all items in the return part. Your autoload_files.php should look like below:

Then execute the following command in project root to expose Drupal’s resource to public folder.

And now when you run your symfony application, you should see the Drupal installation page 😀

There are many interesting things to do, like bridging between Drupal entity and Symfony entity, synchronizing database configuration in 2 systems, integrating Symfony entities in views. But this is a good start already.

Android: quick way to remove spinner background

So, in an Android project, i have to remove the dropdown background of Android spinner and make it transparent completely. After a few googles, you can actually do this with custom style but I want a really quick way.

At first I try android:background="@android:color/transparent" inside Spinner tag, but it only make the spinner disappear (??). I also tried ShapeDrawable or LayerList but no luck. Spinner background parameter only accepts Graphic / Bitmap resource.

Then after a few tries, I found out the solution and it is quite simple. You just need to create a 1×1 transparent png, and set android:background="@drawable/transparent" . The background will disappear while the spinner still behaves correctly.

Simple trick but works 😀

 

SMTP Service Round-Up

Spending lunching time to look for a cheap and reiliable SMTP cloud service, I sum up this post so it may be helpful for others. To me, SES price is most reasonable, but you will have no support and implement the tracking yourself.

Service Cost to send 100k emails / month Additional Features / Remark
SMTP.com 130$ (using email delivery lite plan)
  • Email / Phone Support
  • Dedicated IP (with higher plan)
  • Anaytlcs / Tracking
ElasticMail 50$ (using providedcalculator)
  • Analytics / Tracking
  • Lists & Email Template (somewhat like Mailchimp)
  • SMTP / REST
SendGrid 79.95$ (Silver Plan)
  • Email / Phone Support
  • Dedicated IP (with higher plan)
  • Anaytlcs / Tracking
CloudSMTP 50$ (0.5$ / 1k emails)
  • Analytics / Tracking
  • No visible document about API 🙁
Amazon SES 10.29$
(using AWS Calculator, assumed that email size is 20KB, sending 3333 emails / day, no free tier included)
  • SMTP / REST
  • No Tracking ??
Jango SMTP 250$  (plan up to 120k emails)
  • 100KB / email limit
  • Additional data can be purchased with 1$ / 10MB