Fork me on GitHub

Welcome

Welcome to iamjeff.be
I'm Jean-François Lefebvre, a passionate PHP/mobile developer living in Brussels, Belgium. This is my technical blog where I'm experimenting and sharing my ideas or findings with the world. Feel free to check v2 which is my sandbox where I play with Silex and various REST APIs.
If you like pinterest and are looking for a script to build a page with your pins, you should check my pinterest page, the code is available on github .
Don't hesitate to contact me.

jeff's blog

v2

Feel free to check v2 which is a personal project with the goal to create a simple content management using markdown formatting and social media integration built on top of Silex and the best of open source software. The kind of cms to create a simple blog.The goal is to keep the essential features needed without all the usual stuff that you get and you really don't need. Your social media data are displayed in the homepage with a perpetual scrolling page system. V2 project allows me to build my vision of what should be my ideal cms and in the same time serves as a playground to experiment with different technologies. I like to explore concepts like minimalism and lean web development, that's why Silex is my micro-framework of choice.

android config

Cyril Mottier has a great post about getting a productive android development environment. It's really useful to find the best tools to avoid frustration that can come with android tools especially the emulator and tips to make things easier and faster when you are developing or even learning to create android apps.

Basically he uses three things :

  • genymotion which is a fast virtual device based on virtualbox to replace the default emulator.
  • android studio : using eclipse can be painful, slow and sometimes even crashes. Android studio is based on IntelliJ IDEA and can be a good alternative. It's still under early access preview.
  • Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else. It combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build.

So, I've updated my environment and play around with all these new tools.
I think that switching to an SSD drive can improve A LOT your daily experience as a developer. I've seen a lot of BEFORE/AFTER videos on youtube and it's really impressive to see the improvement that it can bring.

Stripe : A REST API documentation beautifully crafted

Stripe is a suite of APIs that powers commerce for businesses of all sizes. You just have to register and with several lines of code you can implement a simple form in your web site to accept payment.
The thing that struck me on the back-end and the API is the stunning beauty and attention to every detail.
It seems that they have implemented their own REST API documentation generator, there is some open source packages to generate documentation but nothing close
to the following documentation in terms of awesomeness. SAMI does a pretty good job, but generating documentation for REST API requires a tool specialized.

Stripe : A REST API documentation beautifully crafted

The Wolf of Wall Street VFX Highlights

A look at some of the more challenging shots put together from Martin Scorsese's new film The Wolf of Wall Street, starring Leonardo DiCaprio, Jonah Hill, and Matthew McConaughey.

android throwing NetworkOnMainThreadException when trying to open a socket

I'm currently improving my inspiration widget and it stopped working on nexus7.
With android api >=16, it throws an NetworkOnMainThreadException when I try to make http request.
If you want to make it work, you must execute your code in a thread.

new Thread(new Runnable() {
            public void run() {    
                try { 
                        // your network related code
                }catch (IOException e) {
                } 
          }
     }).start();

Source; Stackoverflow

Nexus 7 - Inspiration widget - hello@e-volution.be

How to enable developer settings on the nexus 7

Very weird, but google has hidden the development settings on the nexus 7 by default.
To get them back :

  1. Go to the settings menu, and scroll down to "About phone." Tap it.
  2. Scroll down to the bottom again, where you see "Build number."
  3. Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. Keep on tapping, and then at the seventh tap you will receive a final message telling you that you are a developer now.

A new item is now available in the system section of the main settings to change the development settings.

Pinterest and casperjs scripts on github

After several attempts, I've finally succeeded to webscrap pinterest pins.
Feel free to clone or fork my pinterest project.
It provides scripts to webscrap data from pinterest : it's done in two phases with a casperjs script to download all pins data and a PHP script to download locally original images
and create thumbnails. And finally, the index.php implements a cool and elegant way to display your pinterest pins using perpetual scroll and Wookmark jQuery plugin.

Based on these scripts, I've implemented a web app helping people to save their pins to their dropbox account. More infos soon.
I'm thinking about a free version (one shot) and a PRO monthly paid version including sync of the data. The project is built on Silex, MySQL, Zurb foundation, Zurb ink and jQuery.

Last experiments

This week, I've made some small updates.

- my drupal theme is now based on bootstrap 3 which is mobile first by default. I've switched to a different web font/size. I really satisfied with the result.

- I've installed the memcached drupal module and configured it to use the memcached instance that was already running and used to store my inspirational quotes data served by a REST service to my android app..
My first impression is that it's running faster, but I should make some benchmarks to get a more precise idea.

- My pinterest webscrapping script has been updated : I'm still looking for an automatic way to web scrap my pins. It was the case when pinterest was using a simple parameter allowing to specify the page number but they switched the UI using a perpetual scrolling page based on ajax requests.

At this point, I'v a javascript/jQuery script that I execute when my pinterest page is loaded (http://pinterest.com/iamjeff75/pins) to force the perpetual scrolling page to load all the pins and then displaying in the browser a list of the data extracted from the DOM with jQuery, After that, I copy and paste the content to a file. Then, the second step is to run a php script which process the file, retrieves the pins to store them locally and save extra data (image name, width, height, description, board name associated) in a database or a json file. It's a one shot process, because to retrieve the last pins, you just have to parse the first page with a script runned frequently enough.

Feel free to check my pins, showcased with the help of Wookmark jQuery plugin + lightbox.

oroCRM installation tip

oroCRM is an easy-to-use, open source CRM with built-in marketing tools for your
ecommerce business.

As I like to install and play around with open source stuffs, I've installed it on my VPS at rootnerds.
User: jeff Password: admin

The oroCRM github README explains the basic steps (not in detail) regarding the install process.
From my own experience, here is the three things that I had to check/fix :

  1. check that you have given write access to usual symfony folders such ass app/cache app/logs and especially web/bundles
  2. it seems that libXml2 could make the application crash, so if you see in your log PHP fatal errors with a message such as "complex type 'call': The content model is not determinist.", you will have to make a downgrade. It was the case for me and has fixed the problem. I used the following version of libxml : (I'm using centOS 5.9)
    yum downgrade libxml2-2.6.26-2.1.21.el5_9.1
    
  3. The user interface being based on ajax requests, it could fails to load routes.js on some actions, use the following symfony command to generate the route.js ressource if it's missing on your filesystem.
    app/console fos:js-routing:dump --target=web/js/routes.js
    app/console assetic:dump
    
  4. That's all I had to check and fix to make it running smoothly.

How to install Google Chrome 28+ on CentOS 6

If you are using a linux distribution such as Redhat or CentOS and have tried to install chrome recently, you have received the following error message :

[root@localhost Downloads]# rpm -ivh google-chrome-stable_current_x86_64.rpm 
warning: google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
	lsb >= 4.0 is needed by google-chrome-stable-29.0.1547.65-220622.x86_64
	libstdc++.so.6(GLIBCXX_3.4.15)(64bit) is needed by google-chrome-stable-29.0.1547.65-220622.x86_64

To fix this, check the solution provided by Richard LLoyd.

Glances an Eye on your system

Glances an Eye on your system http://nicolargo.github.com/glances.
Glances is a cross-platform curses-based monitoring tool written in Python.
It uses the psutil library to get information from your system.

Glances

Installation

$ port install glances

OSX display mac addresses for all network devices

networksetup -listallhardwareports

Chrome DNS page

Chrome has his own dns cache, to manage it, go to the following page

chrome://net-internals/#dns

automate the use of apktool and dex2jar

I wrote a small php script to run in shell helping to use apktool and dex2jar to reverse engineer an android application apk file. You will get access to the androidmanifest.xml decoded, the images and java clases that you will be able to decompile with jd-gui. I'm using it to get some ideas how to organize projects and most of all because I'm curious and love to understand how things work.

The script is shared on Gist.

V2

In the open source world you have several cms that are loaded with features but most of the time there is a learning curve due to complexity and I've decided to build my own cms with a small set of features providing the basic structure/tools/good practices to create and deploy easily a web site for small/midsized projects.

I have to admit that I'm obsessed with the idea of "lean programming". So, I've written down a list with the essentials features needed for my own publishing tool oriented for web developer.

At this point V2 is more a sandbox to play with various technologies and librairies, but I'm still working on the cms part. All the code to import data from twitter/google+/pinterest/github is already working, more APIs will be integrated but the current ones are the most important for me.

You can take a look at the V2 preview

V2 is built around composer, Silex micro framework, Twig, RedBean ORM, Bootstrap, TagIt!, jQuery and evolution library.

Twitter API - Converting the created_at field to timestamp

echo date(strtotime($tweet['created_at']));

The format used by twitter in the created_at field is

echo date("l M j \- g:ia", $timestamp);

Displaying information about the memory usage

echo  "\n$(top -l 1 | awk '/PhysMem/';)\n"

Searching for the last files modified since 1 day

find / -type f -mtime -1 -print0 | xargs -0 du -sk | sort -nr

How to install and use composer on mediatemple

Here is a quick tip wich will help you to install and use composer on your mediatemple hosting.

original source : Jamie on software

Installing composer

curl -s https://getcomposer.org/installer | php -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar

and then run composer ...

php -d memory_limit=512M -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar composer.phar

This is ugly, so let's clean it up. We'll add an alias to the bash profile:

$ vim ~/.profile

We'll alias get_composer to our install command and composer to our composer.phar file. This way we can set up new subdomains and such easily:

alias get_composer="curl -s https://getcomposer.org/installer | php -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar"
alias composer="php -d memory_limit=512M -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar composer.phar"

Save, and reload the profile (this will be done automatically next login):

$ source ~/.profile

Now, we can use Composer to our hearts' content:

$ get_composer
All settings correct for using Composer
Downloading...
Composer successfully installed to: /....
Use it: php composer.phar
$ composer -V
Composer version cb2a0f4

Eden : A PHP library for rapid prototyping



Eden is a PHP library designed for rapid prototyping, with less code. Yes, Really.<br />

Eden is a library allowing to access various APIs, in just several lines of code, access web services of web sites such as twitter, facebook, paypal, google contacts, google drive, youtube, google maps, foursquare and many others. But not only APIs ! It provides reusable components to manage Mail, Cache, Database, Payment gateways. Core functionnalities can help to build web application prototypes and it really integrates easily with existing frameworks or CMS.
I've experimented myself : in less than 30 minutes, I've integrated the library in symfony and accessed my twitter and youtube data.

Syndicate content