Monthly Archives: October 2014

Laravel 5.0 – route annotation

This is are my discovers on the new routing system on Laravel 5.0.

Yah! I was trying, yesterday to use this new thing on Laravel.
Theres a huge discussion about in on Laracasts (https://laracasts.com/discuss/channels/general-discussion/route-annotation-in-laravel-5) … I’m not concerned about it… I just want it to work… how/why have they chosen this way its *their* problem.

Ok! yesterday I got a little mad with it.
I was following the book! and I wasn’t getting it to work.

This is how it works.

We need to add our controllers to app/Providers/RouteServiceProvider.php.

RouteServiceProvider Laravel 5.0

Add your new controller to the list.

On our controller

 /**
 * @Get("/tos/")
 */
 public function terms()
 {
     echo '<h1>Terms of Service!</h1>';
 }

 

After adding all your route annotations, you will need to update the “route:list” or what they call…

This is how…

php artisan clear-compiled
php artisan route:scan

and list them on console…

php artisan route:list

Your routes should work now.

 

 

 More readings

http://mattstauffer.co/blog/laravel-5.0-route-annotations
https://laracasts.com/discuss/channels/general-discussion/route-annotation-in-laravel-5
http://www.reddit.com/r/laravel/comments/2jex9b/introducing_route_annotations_in_laravel_50/

 

Preload images with JavaScript without frameworks

Here’s a good article about how to preload pics/images without frameworks.

There are two scenarios here. Case 1: you just want to load all your images prior to displaying the rest of your page. Whether that’s because you like it this way or you need to get the browser to ‘know’ your images widths and heights first, preload a gallery of images, it does not matter. The arguments for ‘speeding up’ page loads are a bit moot now, with modern connections and modern browsers there are no great benefits to this. Either way, you need to arrange your code in a way that allows you totrigger some event or function when the loading is complete in order to continue displaying your site.

And then, there’s case 2: pre-emptive image loading / cache priming, which is the more interesting use. This is a relatively new trend that involves examining the user’s browsing pattern and anticipating what they do next. For instance, if they are browsing product listings as a result of a search with 100 results (20 per page), it is almost safe to assume they may want to go to page 2 or 3. It is also safe to assume the average user would take a while to finish appraising their results, scroll down and locate the ‘next’ link. This idle slot is where you can put their connection to better use by priming the browser cache with the product thumbnails of the next results page. In this instance, you don’t really care for any onload / oncomplete events, the benefits of the cache will be reaped on the next page instead.

Read it all on http://fragged.org/preloading-images-using-javascript-the-right-way-and-without-frameworks_744.html

 

 

Logstash+ElasticSearch+Kibana

Some references for Logstash+ElasticSearch+Kibana

These log files are still hard to use on their own. They are made by a computer for a computer and I am human trying to understand other humans. Logstash, ElasticSearch and Kibana to the rescue! Logstash is a tool for managing events and logs. You can use it to collect logs, parse them, and store them for later use (statement humbly borrowed fromhttp://logstash.net). ElasticSearch is a distributed restful search and analytics engine (yet again borrowed, but fromhttp://www.elasticsearch.org/overview/). Kibana is a GUI tool to visualize logs and time-stamped data in realtime (yet again borrowed, but from http://www.elasticsearch.org/overview/kibana/). These three tools make up a pretty good toolkit for creating some graphs and dashboards.

Read more at  http://nhhagen.wordpress.com/2013/11/28/query-log-analysis-using-logstash-elasticsearch-and-kibana/

 

Continue reading Logstash+ElasticSearch+Kibana

How to start a startup without ruining your life

 

Startups are emotional roller coasters that one minute make you feel like you’re changing the world and the next minute, that everything is falling apart.

For 6 years of my professional life, I worked only at startups. I saw myself as “the coder” — the guy that the brave hired to turn their ideas into real businesses. I never had the inclination to start my own… why would I risk a fairly comfortable life to pursue an idea that may not work?

Read it all on https://medium.com/@riklomas/how-to-start-a-startup-without-ruining-your-life-af45eec09406