W30Y16 – Script to auto forward emails, custom loading GIFs, Google Add-On free ebook, set up / remove proxy settings from your command prompt

Autoforward emails

For those who wants to auto forward emails received in Outlook (work) to their personnal Gmail account, there is a common solution using “Rules” in Outlook but this feature may be disabled by your IT center.

The solution is to add a rule based on a script coded in VBA in your Outlook macros.

First, press Alt+F11 to access to the VBA tool and in the left panel, click on Project1 > Microsoft Outlook Object > This Outlook Session and paste the code below:

Sub SendNew(Item As Outlook.MailItem)

Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)

objMsg.Body = Item.Body
objMsg.Subject = "FW: " & Item.Subject
objMsg.Recipients.Add "joeybronner@gmail.com"

objMsg.Send

End Sub

Save and close the VBA tool.
Now, you’ll have to apply this script to a rule, so, just follow this few steps…

  1. Select in top ruban Home > Rules > Manage Rules & Alerts
  2. Click New Rule
  3. Click on Apply rule on message I receive, Next
  4. Next (Yes on prompt)
  5. Check Run a script and select the script that you have created above, Next
  6. Finish

Now, you emails will be automatic forwarded.

Custom loading GIFs

If you have to add a loading GIF on your own app, you probably would like to have a custom one. If you type on google for a loading GIF you have the choice between the old style loading or some famous like Google+ loading… Loading.IO is a website where you can choose a loading style and customize for your app colors. And you can export your work in different format:

  • SVG
  • CSS
  • GIF

The Ultimate Guide to Google Sheets

The Zapier team has pulled all of their Google Sheets content together—including the very complete post from earlier this month that included my Translate My Sheet add-on—and turned it into a new free ebook: The Ultimate Guide to Google Sheets. It takes readers first through a detailed intro Google Sheets tutorial, then dives into deeper features that help readers build their own custom tools and apps using Google Sheets’ most powerful features.

You can download this free ebook on these platforms:

ultimate_google_sheets_book

Proxy settings

Because it’s something that we have to do some times (in my case it’s especially when I’m working on Raspberry boards), it’s useful to keep these few commands in mind:

set http_proxy=http://your_proxy:your_port
set http_proxy=http://username:password@your_proxy:your_port
set https_proxy=https://your_proxy:your_port
set https_proxy=https://username:password@your_proxy:your_port

And to remove the proxy settings, you only have to launch the same commands, without values:

set http_proxy=
set http_proxy=
set https_proxy=
set https_proxy=

Ladies and Gentlemans, Jack Ma

His career vision is very nice. I like his way of thinking. For young people who are 25 years old (and others!), you must make enough mistakes –you fall, you stand up

Design of the week: Google search

That’s a very nice Google search redesign. Good user experience with a modern user interface; This is only a concept created by Juan C. Fresno.

google_search

W29Y16 – Perforce plugin for Sublime, ignoring files, Node.JS prompt and map directions from your Android app

The .gitignore equivalent with Perforce

Easy as Git, you could ignore some files, directories on your code submit. You only have to create a new file named .p4ignore on your workspace root. This file contains a list of rules for ignoring files when adding these to the depot. Example of .p4ignore file:

# Ignore .p4ignore files
.p4ignore

# Ignore object files, shared libraries, executables
*.dll
*.so
*.exe

# Ignore all HTML files except the readme file
*.html
!readme.html

# Ignore the bin directory
bin/

# Ignore the build.properties file in this directory
/build.properties

# Ignore all text files in test directories
test/**.txt

Sublime & Perforce

Due to a team switch I need to use Perforce instead of Git for the source code versionning… and that’s why I was looking for a Perforce plugin for Sublime Text (my favourite IDE for web development).

The only plugin I found is developped by Eric Martel and works fine. It allows you to add, checkout, delete, diff, rename, revert, diff (using p4diff) and list all checked out files. Changelist management is also supported and that’s a very good point.

Node.JS prompt

I’ve found a nice project on Github who allows you to interact with your Node.JS server through your command line. For example, if you have to enter credentials on launching, you only have to import prompt, initialize it and use the get function… Take a look on the repo, there are a lot of functionality.

var prompt = require('prompt');

//
// Start the prompt
//
prompt.start();

//
// Get two properties from the user: username and email
//
prompt.get(['username', 'email'], function (err, result) {
  //
  // Log the results.
  //
  console.log('Command-line input received:');
  console.log('  username: ' + result.username);
  console.log('  email: ' + result.email);
});

Prompt on Github

Get directions from your own app

android_map_intent_google

Implement a navigation in your own app will be expensive in days of development. So, if you want to offer an alternative solution, it’s possible in few code lines (below). This new intent will launch the Google Maps application with start and destionation GPS coordinates. Good solution for a POC in which the navigation is not the main feature.

String from = "20.344,34.34";
String to = "20.5666,45.345";
String endpointURL = "http://maps.google.com/maps?saddr=" + from + "&daddr=" + to;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(endpointURL));
startActivity(intent);

Dribble login

What a nice Dribble login concept. Based on Material Design with some animations (a lot!). The most interesting animation is maybe these when you switch from login in to sign in with the pink logo who slides to the rectangular submit button. Nice! dribbble_login

W28Y16 – Fibonacci implementation, compare JS UI frameworks performance, Android viz libraries and Hungarian notation

Fibonacci implementation

Why fibonacci ? Hum, juste because I was asked for this on my last interview and I stupidly failed with it… So, you’ll two different ways of implementing this algorithm:

  • recursive
  • iterative

The first one (recursive), is more elegant but not performant for big numbers (in fact, you’ll crash your memory by doing a recursive fibo for a number like 10000). The second one is in basic iterative loop do/while.

Mathmatics fonction: fibonacci(x) = fibonacci(x-1) + fibonacci(x-2)

Recursive

function fibonacci(n) {
  if (n < 2) {
    return 1;
  } else {
    return fibonacci(n - 2) + fibonacci(n - 1);
  }
}

Iterative

function fibonacci(n) {
  var a = 0, b = 1, f = 1;
  for(var i = 2; i <= n; i++) {
    f = a + b;
    a = b;
    b = f;
  }
  return f;
}

The fibo implementation in a looooot of different languages: http://www.scriptol.fr/programmation/fibonacci.php

JS UI framework perfs

ui_frameworks_comparison My colleague Justin (the tech surveillance killer) just sent me a nice repo about the comparaison most famous UI frameworks you could find. This dashboard allows you to decide regarding performances on:

  • rows creation
  • rows upodating
  • partial rows updating
  • selection of rows
  • swapping
  • etc, etc…

Just follow this link to see the comparison: HERE
And here to see the github repository: HERE

Hungarian notation

The Hungarian notation is very useful for languages with a loosely type like Javascript. This notation method is also used like an identifier to know the expected type of the variable. Some examples of naming variables using this convention:

  • bBusy : boolean
  • chInitial : char
  • cApples : count of items
  • fBusy : float (or flag)
  • nSize : integer (Systems) or count (Apps)
  • iSize : integer (Systems) or index (Apps)
  • dbPi : double (Systems)
  • rgStudents : array, or rangee
  • fnFunction : function name

Wikipedia about Hungarian notation

Android chart/viz libraries

I just tested two different Android chart/viz libraries from this github repo who regroups a good exhaustive list of viz libraries for a lot a languages (including Android of course)

HelloCharts

Very good if you only want to show some column charts, bar charts, lines charts, donuts. Charts are highly customizable :

  • fonts
  • sizes
  • colors (lines, points, axes, …)
  • background
  • with/without points
  • filled spaces
  • etc, etc…

HelloCharts Github Repository

I’ll stress a point, you don’t have any legends for your charts! that’s important because if you want one, you want need to create it manually…

MPAndroidChart

I’ve got some problems while adding MPAndroidChart as a dependency to my Android project, so I switched to HelloCharts. Maybe the wiki was deprecated, in the middle of a new version ?… I don’t know.
Anyway, this library is more complete, and maybe better, so if you are successful on adding this lib to your project: use it!

Animation concept

Nice animation concept by Mario Wahl that you can find on Dribbble.

Because code without design is not really usable, I’ll share, in each weekly article, a design creation that I liked (icon, animation, UI, workflow, …).

preview

W27Y16 – Inbox, Android Studio, Gradle, Chrome shortcuts, Markdown anchors and more.

That’s a transition for my blog: from now, articles will be written in English! (sorry for all the English langage mistakes, it’s the beginning).

Number of different topics for this week: 6

Shortcuts to topics
Prevent the Gmail to Inbox redirection
Chrome useful shortcuts : new / close tabs
Hum, build.gradle problem
Retrieve the dimensions for an SVG element
Use a custom font in your Android app
Anchors in your markdown file

Prevent the Gmail to Inbox redirection

bringbackgmail I was unpleasantly surprise to see that my Gmail account was redirected automatically to Inbox, without my knowing! To prevent this behaviour, you have to go to your Inbox page, in the left panel select “Settings” et uncheck the automatic redirection Redirect Gmail to inbox.google.com.

Chrome useful shortcuts : new / close tabs

cmdplus These two shortcuts are my favorites and I use them very often with Chrome:

  • Cmd + T to open a new tab
  • Cmd + W to close the current tab

Hum, build.gradle problem

gradleversions I just get an error message at the moment I tried to launch the gradle build…

Error:(1, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Could not create plugin of type 'AppPlugin'.

It’s simply because I’ve loaded an old project and my gradle settings had been modified without my knowing… The solution is also to change this settings:

  • Android Studio > Preferences > Build, Execution, Deployment > Gradle

Check the Use default gradle build wrapper (recommended). If the problem persist, I’ve a second solution : go to this link (http://tools.android.com/tech-docs/new-build-system) and get the latest plugin version number and edit your version number in your build.gradle file from your project (classpath ‘com.android.tools.build:gradle:2.2.0-alpha4’ for example).

Retrieve the dimensions for an SVG element

svgdimensions Easy, you only have to call the method getBBox() who returns a JSON object with all the properties you need:

  • x
  • y
  • width
  • height

An example of use…

var element = document.getElementById("box");
var elementbBox = element.getBBox();

Use a custom font in your Android app

fonts To use a custom font, it’s pretty simple. You only have to copy/paste the .tff in the assets folder from your project (this folder location is very important).
Now, you can use it in the activity class like this:

Typeface tfCustom = Typeface.createFromAsset(getAssets(),"Roboto.ttf"); 
tvHelloWorld.setTypeface(tfCustom); // tvHelloWorld is a TextView for example

A good practise is to create a subfolder “fonts” in the assets folder.

Anchors in your markdown file

anchorsmd I think that anchors in big markdown files are very interesting! The use it, first declare your html balise, for example in your H3 title like this:

<a name="myanchor"></a>

Now, add an hyperlink to the word you want to shortcut to this anchor:

[link](#myanchor)