From my hosting platform (e.g. cPanel), I created two subdomains for web apps. The web apps reside in the following directories: /foo/bar/app_one/ /foo/bar/app_two/ And the subdomains I created are accessed through these URLs: http://app_one.bar.domain.com (pointing to /foo/bar/app_one/ directory) http://app_two.bar.domain.com (pointing to /foo/bar/app_two/ directory) For security purpose, I don’t want anyone to access the web app […]
Technology
Learning MongoDB on Windows 7 (Shell Edition)
I’ve worked on a high-volume site that processed thousands of telecom network subscribers everyday. Me and the rest of the team managed to handle the challenges using MySQl and query optimizations, but now, I wonder how easier the tasks would have been if we had used NoSQL / MongoDB back then. My environment and methods: […]
Laravel 5: create route group that is only available during testing (Middleware)
Today I needed to protect a group of routes from everything except my testing environment. I need to run PHPUnit tests that depend on certain routes, but I don’t want those routes to be available anywhere else. I’ll share in this blog post what I did to get what I need. Assumptions in this tutorial: […]
Laravel 5: activate API token guard and print “Unauthorized” instead of login redirect
In Laravel 5, I wrap my API routes in a route group like this:
1 2 3 |
Route::group(['middleware' => ['auth:api','throttle']], function() { // API routes here }); |
Notice that I use auth:api and throttle on my middleware array. auth:api turns on the auth middleware with API token as guard, while throttle activates rate limiter for APIs. To get started with API token authentication, you may read https://gistlog.co/JacobBennett/090369fbab0b31130b51. […]
Android app dev: ShareActionProvider in Activity & Fragment
I’ve been taking the Developing Android Apps course on Udacity, and yesterday I encountered a difficulty in solving the Quiz: Share Intent. One of the course’s goal is to build the Sunshine App – an Android app with weather forecast. In that quiz I had to implement ShareActionProvider on my DetailsFragment so that a share […]
Mac OS X – Sublime Text 2 key bindings suddenly stopped working (SOLVED)
https://www.sublimetext.com/docs/2/revert.html I’m using a Mac Mini with OS X El Capitan (v. 10.11) with Sublime Text v.2.0.2. Today, Sublime Text shortcuts like Cmd + / (line comment), Cmd + D (multiple selection), Cmd + F (find) and others stopped working. I had no problem with those key bindings before until today. Based on research, I […]
Laravel 5 RESTful API with Basic Auth: PHPUnit Testing
I’ve been using PHPUnit to test my RESTful API. PHPUnit is ready to use in Laravel. In my Laravel-based RESTful API, I have an endpoint /api/users which returns JSON data when you send a GET request. The API will only return such data if the client sends the corrent username and password (Basic Authentication). The […]
Android M runtime permissions utility class
Hello world, I prepared a PermissionsUtil.java class and it’s on GitHub. Check it out: AndroidPermissionsUtil Why use it? It will help by letting you write less code as you add conditions to your Android app that supports Android 6.0 (Marshmallow). The utility class defines helper methods that were used in the following example. Sample usage […]
Android app codes for Google Maps with clustering
I prepared Android app codes with Google Maps and clustering feature. Feel free to use these as basis for your new projects. They are on GitHub: [1] Default Map Markers: catzie/SimpleAndroidMapClustering [2] Custom Map Markers: catzie/Simple-Android-Map-Clustering-with-Custom-Markers I simply took the necessary classes and res files from Android Maps Utility demo, and then placed […]
Android Maps: Get current location coordinates with Google API Client Builder
To get your current location via Google Map in an Android app, this was how we do it:
1 2 3 4 |
@Override public void onMapReady(GoogleMap googleMap) { Location location = googleMap.getMyLocation(); } |
Stop. Don’t use that! The method GoogleMap.getMyLocation() is deprecated. Instead, we need to use FusedLocationApi and the callback onLocationChanged(). Here’s an example code that works for me ( consider copying the contents of onResume() into onStart() […]