Thursday, January 21, 2016

Using Protocol vs "Protocol-Less" URL (for linking in HTML)

Dev Fam,

Recently I came across some code that upgraded the way I <link> in my web apps (i.e. HTML pages).

New Code (no https/http): 
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />

Old Code (or traditional way):
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />

Going "Protocol-Less"

Here is a good discussion on why I've decided to use "protocol-less" URLs in my webapps:
http://stackoverflow.com/questions/4831741/can-i-change-all-my-http-links-to-just

Some more discussion on SO:
http://stackoverflow.com/questions/8997790/why-does-an-anchor-tags-href-values-need-http-preprended-to-the-url

Also notice (tip on referring to local file):
http://stackoverflow.com/questions/12837024/href-file-doesnt-work

Going deep into discussion:
https://moz.com/learn/seo/internal-link

But, it's always up to you as the developer to decide. May the force be with you!

G2

Wednesday, January 20, 2016

CSS: Selectors with spaces different from Selectors w/out spaces

CSS Selectors with Spaces between

Recently, I was following a YouTube in learning more about jQuery and came across the author's CSS.

He had the following:

.tab-panels .panel.active {
  display: block;
}

I had almost exact code, but wanted to add a space in between ".panel" and ".active" for easier reading.

.tab-panels .panel .active {
  display: block;
}

Here's the HTML we had (or that he had and I copied):
      <div class="tab-panels">
        <ul class="tabs">
          <li class="active">panel1</li>
          <li>panel2</li>
          <li>panel3</li>
          <li>panel4</li>
        </ul>
      </div>

However, my active panel didn't display. When I typed exactly the code that the author had, then my active panel displayed. Why?

Well, learning from http://stackoverflow.com/questions/6885013/how-to-select-classes-with-spaces, adding spaces in between CSS selectors creates new meaning for the class attribute. The CSS rendering is looking for elements with class="active" that have a parent element with class="panel". In detail, this will also look for the next parent element (or grandparent element) with class="tab-panels". By removing the space in between the selectors, we'll now look for the element with class="panel active" (where the dot is replaced with a space in class attribute value).

Friday, December 4, 2015

Data Analytics: Processing Images

Dev Fam,

This is pretty useful to know. Eventually, when I get the time, I'll look further into using this myself. But for now, just wanted to spread the news in case you haven't heard.

http://www.pcworld.com/article/3011757/developers-get-new-tools-from-google-to-analyze-images.html#tk.nl_today

http://thenextweb.com/google/2015/12/02/googles-new-cloud-vision-api-helps-teach-machines-to-better-understand-images/



Collecting data has always been a huge deal. Marketing terms like "big data" and "hadoop" have been constantly thrown around industries in attracting companies and customers. However, what's been difficult to analyze has been images collected. Thus, this makes such APIs as the ones mentioned in the article above a pretty powerful tool. Analyzing images and creating more metadata regarding the image and updating data storing appropriately to benefit the data analytical tools applied - will be very helpful in making better decisions shaping the future of people, companies, industries, and the world.

May the force be with you,
G2

Thursday, November 12, 2015

Vagrant - Useful Commands

This is a list of useful commands to use with Vagrant. These commands are useful to know and saves time on searching. To see the argument options along with the command, click on the command.


Vagrant Reference URL

Manage (add, remove, etc) virtual boxes

$vagrant box
// See the list of boxes installed into Vagrant.
$vagrant box list
// See any outdated boxes currently installed.
$vagrant box outdated
// Remove a box (and replace NAME_OF_BOX with the actual name of your box)
$vagrant box remove NAME_OF_BOX
// Update current box in Vagrant
$vagrant box update

Create, configure box

Create, configure guest machines according to local Vagrantfile.
$vagrant up

Suspend virtual box

Suspend guest machine in use (that Vagrant is managing) rather than shutting down or destroying it. This effectively saves the exact point-in-time state of the machine for resuming later (instead of full boot).
$vagrant suspend

Halt virtual box

Shuts down the running machine (box) Vagrant is managing. If graceful shutdown fails, then use argument 'force' to shut off completely.
$vagrant halt
$vagrant halt --force
$vagrant halt -f

Destroy virtual box

Stops the running machine (box) Vagrant is managing and destroys all resources created during the machine process. This leaves your machine in a clean state as if never used (like a reset button).
Use the 'force' argument to bypass the confirmation dialog.
$vagrant destroy
$vagrant destroy --force
$vagrant destroy -f

Reload virtual box

Halt followed by an Up.
$vagrant reload


Git - Useful Commands

This is a list of useful commands to use with Git. Once in a while, my Windows GitHub GUI app is not working as I would like and I need to do some back-end coding to speed things up. Other times, I just want to bypass using the GUI to speed up my coding or to automate processes. These commands are useful to know and saves time on searching.


Git Reference URL

Refresh my branch list (all branches including master)

- list both remote-tracking branches and local branches.
$git branch -a

Refresh my branch list

- list the remote-tracking branches.
$git branch --remotes
$git branch -r


Tuesday, November 10, 2015

Friday, November 6, 2015

Learning PHP - How to Begin and Win!

Dev Fam,

This is a good way to get started with learning PHP.

http://code.tutsplus.com/tutorials/the-best-way-to-learn-php--net-22287

The author, I think, has done a pretty good job with summing and articulating the steps to hit the track running as a PHP Developer.

Here are some book references as well.



Cheers,
G2