Stack Setup

I will be doing quite a bit of coding, especially in machine learning, so it would be a good place for me to blog what I believe would be the most basic setup for someone to get started on a fresh computer.

Additional Setup Step for Mac

My computer is a Mac, so there is one more step! Homebrew!! (Or use the code below in your terminal)

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

After installing homebrew, just use brew to install Git, Sublime, and everything else.

Basic Installs

Before you even decide on what stack you would want to go with (Given that you have very little to no programming experience.) I think you should get the following:

  1. Github (Or equivalence such as Bitbucket.)
  2. Sublime [1] (Or equivalence such as Atom or VSCode.)
    • Vim doesn’t count.
  3. Postgres (Or equivalence such as MySQL or MongoDB.)

Now on to the language of your choice! I went with Python3 and JavaScript. Anything after this would be whatever you want! (AKA building your OWN stack.)

The next thing is to link your ~/.bashrc with your ~/.bash_profile so you could just update one main bash file for all of your custom commands in case you have to access both login and non-login terminal on your Mac.

To make your life easier, you may also want to add

subl

as a command to launch sublime with this tutorial.

Lastly, SSH! If you want a more secure way to communicate with a server without typing in password. 🙂

Python Customization

If you are new to Python, I suggest you go straight into Python 3. Here is a pretty good intro on what you’d need for the setup. I’ve also installed some of the sublime plugins following this tutorial and this post, however, YMMV. If you are coding in Python 2, DON’T remove the pre-installed python and install python via brew. [2]

Reference
  1. https://www.codementor.io/mattgoldspink/best-text-editor-atom-sublime-vim-visual-studio-code-du10872i7
  2. http://docs.python-guide.org/en/latest/starting/install/osx/

The prefect FREE template?

For the last two days I have come to a realization that I should have a personal website. Of course, I am pretty broke (Despite being an “Engineer”…) so I opted for a free account for now and plan to upgrade in the, hopefully, near future. (Also because someone took tinglik.com and ting.com, which makes me extra sad…)

The end goal of the site, in my mind, is to have a simple, yet elegant, UI for the all the pages. This, to me, means,

  • Menu should be showing easily accessible (No click and extend)
  • Options to remove the title of the page
  • Header Image for each page including post page
  • Visually appealing social network icon
  • A customizable portfolio page

This is pretty much about it.

I have been browsing through templates after templates… Namely Harmonic, Goran, Dyad, and Affinity are some of my favorite ones, but they are all missing in one aspect or another…

For Harmonic, pretty much the only thing missing is the header image for default template… I mean… WHY WOULD YOU KILL IT? Can’t we have just have an option to hide/not load it if we don’t want to?

For Goran, it clean and nice… But, again, the header image is not showing on the post-page this, an equal/opposite problem with Harmonic.

Affinity has the features that I found aligns with what I want… but the style too “elegant” for me.

I like Dyad a lot! The feature image for pages and posts add an addition pairing feels to the posts and page. The project reminds to be the fact that header image is not showing for all of them. It’s simpler than Harmonic and much faster to load than Goran, but I decided to keep Harmonic for now, let’s see where it could take me.

 

Google Sheet GUI

I originally wanted to build a webapp that interacts with databases such as Postgres or MySQL using Python, host it via Heroku, and display it with iframe, but it was too much work. (Mainly because I don’t know how to do that yet.) So I went with the dumb way and decided to use Google Sheet to build a GUI/Dashboard instead….

However, the problem being I can’t get the published version to interact with the audience. (See below) I also haven’t figure out how to allow users to edit values without them changing the format. In addition, I don’t think google sheet will be mobile friendly… I tried to use plot.ly, but it seems I can’t embed the dashboard with the free account. I tried iframe plot.ly’s chart and it didn’t work. Looks like I will have to build it with google app script for real now  :'( Let’s hope that it could interact with google sheet and DB nicely as I’d love to avoid PHP… It should still be simpler than building it with python because I would have to build the GUI with Django, which I don’t know Django at the moment, that displays the table as well. Furthermore, who know if Heroku would play well with WP… (Doesn’t seem like it the other way around…) This will be a good opportunity for me to familiarize myself with JavaScript, though PHP may be better if I have to interact with Big Data in WP.

https://docs.google.com/spreadsheets/d/16hJ11aB0kn4MwYthlXXdn7UD-9kyHmxDPUOySGF56YU/edit?usp=sharing

Google App Script is DUMB! First of all, I would have to recreate the same script if I want to convert it to Google Site Gadgets. In addition, the problem being Google now has two site system, the classic and site, and the new site system doesn’t seem to accept Gadgets…

WebApp using Google App Script:

Reference:

  1.  https://en.support.wordpress.com/google-docs/
  2. https://www.blockspring.com/blog/google-spreadsheet-as-database
  3. https://cloud.google.com/appengine/docs
  4. https://developers.google.com/apps-script/
  5. https://code.google.com/p/google-apps-script-issues/issues/detail?id=852

Non Related Reference:

  1. http://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job
  2. http://noeticforce.com/python-online-compiler-interpreter-code-editors
  3. https://www.smartsheet.com/product-tour/card-view
  4. https://www.eisbahn.jp/chrome_mysql_admin/
  5. https://www.geogebra.org/

Framework, CMS, Django

I am helping one of my friends setting up a website, and I am thinking of starting a web service business after I learned many of her friends are also in need of a website. I know how to code with Python and I am learning JavaScript but I am no expert in web development. While I would love to develop from the bottom up eventually, I don’t think I will have the time to do so right now. This means CMS. What is CMS or Content Management System? In short, if you have heard of WordPress or any other point and click web building website, that’s CMS, while framework is a coding platform that guides the developer to create a website, e.g. Django for Python or Ruby on Rail. See below for more details.

A Framework or a CMS? What is better to choose?

With my background in Python, I looked only at CMS based on Python with Django. With number of choices floating around, Django-CMS, WagTail, FeinCMS…

Best choice for a CMS package? from django

I am going with WagTail, because I am a vanilla kind of guy [1, 2].

Reference:

  1. http://www.djangopaths.com/why-did-i-choose-wagtail/
  2. http://www.executionunit.com/blog/2012/02/18/migrating-from-wordpress-to-django-cms/
  3. https://support.rackspace.com/white-paper/understanding-the-cloud-computing-stack-saas-paas-iaas/

Up! Going into Cloud Computing

I have been coding random projects here and there for a while now, and I think the next step for me is to deploy them into the cloud and have them run while I am offline.

Before looking into various cloud service, the first, I think, should scratch out and understand the scope of my projects and my capabilities, which is not much. Knowing this, I went with PaaS over IaaS, but for everyone else it would be a good idea to understand the difference [1, 2].

After reviewing many available options [3, 4] (mainly Google App Engine, Windows Azure, and AWS), I went with Azure solely because I don’t have time to build apps on AWS or Google and their free version has a time limit (2 months for Google and 1 year for AWS… I know I can definitely have time within a year, but one thing at a time…)

The first thing I did was to add a WordPress CMS into Azure. It was very simple all I needed to do was few simple click. On New Year’s day, I registered a domain. With that, I follow [7] to add my custom domain to my Azure… and here you are!

It has been a day since I first deploy this site on Azure, it looks like I keep running into the problem which tinglik.co is not connecting with www.tinglik.co. I have played around with domain name registrations [8, 9, 10]. If you have realize on the address bar, this site is not secure (I am a real person!) mainly because I am too cheap to buy a certificate, $50 a year for www and $300 for wildcard. AIN’T nobody for blings got that! Somehow, after from adding and deleting with my DNS setting (I didn’t touch the A record though…) I seem to got tinglik.co to the site as well. So for now, I guess I will keep an eye on what is going on with this.

In the long run (If any of my projects takes off), I will, of course, expand into paid service, cheap paid service such as [5, 6].

Reference:

  1. https://blogs.msdn.microsoft.com/hanuk/2013/12/03/which-windows-azure-cloud-architecture-paas-or-iaas/
  2. https://www.computenext.com/blog/when-to-use-saas-paas-and-iaas/
  3. http://cloudacademy.com/blog/free-cloud-hosting-comparison/
  4. https://www.quora.com/Are-there-any-free-cloud-computing-services
  5. https://www.linode.com/pricing
  6. https://www.digitalocean.com/pricing/#droplet
  7. https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-custom-domain-name#vip
  8. https://vip.wordpress.com/documentation/mapping-your-domain-and-managing-dns/#managing-dns-records
  9. http://www.networksolutions.com/support/how-to-manage-advanced-dns-records/
  10. https://securingtomorrow.mcafee.com/technical-how-to/security-best-practices-azure-app-service-web-apps-part-1/

Python2 & Python3 in Virtual Environment

I started python2 in 2015 (It’s late… I know, why not Python3 to begin with? I don’t know…) and I set up my coding environment following this instruction (Coming soon). Over some conversations, I have decided to build my next repo with Python3 (Not sure what it will be yet). One of the first thing I learned about Python was Virtual Environment, undoubtedly it was also one of the first thing I looked into after deciding to switch into Python3.

The OS I used when I started python was OSX on a work computer. However, now that I am broke and jobless like many Trump voters, I set up Lubuntu on one of my old computers. The following discussion will be based on Linux environment.

My version of Lubuntu is based on Ubuntu 16.10, so by default it has both Python2 and Python3 pre-installed. [1] You may always check with the following command,

dpkg -l

or just type python3 and see what happens.

Now comes the hard part, decision making time! You will see from a simple google or discussions in [2-4] that you have a choice with venv or virtualenv. After some thoughts, I’ve decided to stay with virtualenv for now since you can easily using python3 in existing virtualenv without installing anything else. However, I believe venv will be the way to go in the long term as venv is now part of the standard libraries in Py3, and Py2 will go obsolete.

To set up Python3 with virtualenv, just use the following command: [6]

mkvirtualenv --python=/usr/bin/python3 env_name

where /usr/bin/python3 is the your python3 location, you may also use which python to find it.

Reference:

  1. https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04
  2. http://stackoverflow.com/questions/12971443/is-python-package-virtualenv-necessary-when-i-use-python-3-3
  3. http://stackoverflow.com/questions/29934032/virtualenv-python-3-ubuntu-14-04-64-bit
  4. http://superuser.com/questions/1039369/how-to-create-a-python3-virtual-environment-as-of-2016
  5. https://docs.python.org/3/library/venv.html
  6. http://stackoverflow.com/questions/16123459/virtualenvwrapper-and-python-3