Posts

Showing posts from April, 2015

Visual Studio Code for Linux, a quick look

Image
Hey, did you hear that Microsoft just released a freecode editor for Linux and Mac OSX called Visual Studio Code? It sounds pretty strange right? Believe me, It's true:

* Official website: https://code.visualstudio.com/

* Introduction video:

×


Here are some screenshots of Visual Studio Code running on my Ubuntu 14.10:








How to embed pdf files into your blog (Blogger, WordPress...)

Image
To embed a pdf file into your Blogger or WordPress blog just follow these following steps:

1. Upload the pdf file to Google Drive

2. Set the sharing option of that file to Public (Everyone with the link can View)

3. Click "Get Link" to get the ID of the pdf file. For example:

https://drive.google.com/open?id=0B5ND3Z6x0cw8MkJTV21DNjZUeVk&authuser=0




4. In your blog, insert this iframe with the ID of your pdf file, for example:

<iframe height="600px" src="https://docs.google.com/viewer?srcid=0B5ND3Z6x0cw8MkJTV21DNjZUeVk&amp;pid=explorer&amp;efh=false&amp;a=v&amp;chrome=false&amp;embedded=true" width="100%"></iframe>

Seth Godin Freelancer Course's Lecture 44, Exercise 6 - Develop a unique voice

Seth Godin Freelancer Course's Lecture 24, Exercise 5 - B2B sales

B2B SALES


What is your client afraid their boss will think if they say yes?

There's someone else can do the job with the cheaper price.

What would your client tell their boss to explain why they bought from you? 

There's no one else in the market can provide such services and as good as mine. I'm also a good communicator who is confident and have better after-sale benefit.


What would you like them to tell their boss?

I'm the only one who can do the job in a unique and remarkable way and will help them to solve the problem.

The two 'I' words to remember

Imminent
About to happen


Instigate
Bring about or initiate (an action or event)





Seth Godin Freelancer Course's Lecture 13, Exercise 4 - Rank Yourself

RANK YOURSELF



Compared to others who do what you do, rank yourself on: reputation, knowledge, expertise,
tools, handiness.

From 0 (worst) to 10 (Best)

* Reputation - 5

Pretty well known in the community, especially the beginners.

* Knowledge - 6

Understand the basic and how thing works. But need more research and hand-on experience.

* Expertise - 6

Good at problem solving and figuring things out. Still need to invest more time in practical cases.

* Tools - 9
Pretty much as a hacker. It means that I can use whatever available.

* Handiness - 8

Can be reachable easily via email.


Which will you invest in developing?

Doing research on the technologies, read more papers, discuss more on the mailing list, help others to solve their problems.

Seth Godin Freelancer Course's Lecture 10, Exercise 3 - List of 10 things

LIST OF 10 THINGS YOU DELIVER TO YOUR CLIENT


Things that aren’t the thing. Things like timeliness, confidence, respect, a story, etc.

1. Confidence

2. Timeliness

3. Responsiveness

4. Honesty

5. Listening to their need.

6. Support

7. Communication

8. Empathy

9. Respect

10. Vision





Seth Godin Freelancer Course's Lecture 8, Exercise 2 - What do you provide?

WHAT DO YOU PROVIDE?


What do people buy when they buy something from you?

They buy my knowledge, my understanding of the Open EdX system, basically, they're buying my technical skill.


Leave out the easy, repetitive, generic stuff... What you are doing that’s difficult?

The understanding of the system that requires lot of research time.

Seth Godin Freelancer Course's Lecture 5, Exercise 1 - Who are you?

These are my answers for the questions given by Seth Gordin Freelancer course on Udemy:

Who are you?


What do you want to do? (Not your job, but your work, now, tomorrow, and in the future)

I want to help Organizations, Institutions, Universities to build their online learning platform using the Open EdX technology or anything that's available. That will enable more and more opportunity for people to acquire knowledge, skills which is not possible before.

Who do you want to change, and how do you want to change them?

I want to change the way Universities, Institutions, and Cooperate Training in Companies working. By applying some of the most advanced and new learning platform to them I can improve the world's educational process.

How much risk? (from 1 [a little] to 10 [bet everything]), how much are you willing to put at stake to make the change you seek?

With my situation right now I will bet 3 of my everything to make the change I'm seeking.

How much work are you willing to d…

Quote of the day

Image
"It's more fun to change the world."
~Craig Newmark


PowerSchool - Query Oracle DB to get a list of students with their siblings

In Oracle database of PowerSchool, to get a list of students with their siblings who also students, you can use the following query:



The important parts of the above query are:

* Group the students of a same family based on the FAMILY_IDENT column of the STUDENTS table:

SELECT
STUDENTS.FAMILY_IDENT AS FAMILY_IDENT,
'<ul>' || listagg('<li>' || STUDENTS.LASTFIRST || ' (' || STUDENTS.GRADE_LEVEL || ')' || ',</li>', '') 
WITHIN GROUP ( ORDER BY STUDENTS.GRADE_LEVEL DESC, Upper(Trim(STUDENTS.LASTFIRST)) ) || '</ul>'
AS SIBLINGS
FROM STUDENTS
WHERE STUDENTS.ENROLL_STATUS = 0
GROUP BY STUDENTS.FAMILY_IDENT

The result will be something like this:

-------------------------------------------------------------------------------------------------------
| FAMILY_IDENT | SIBLINGS                                                                                    |
--------------------------------------------------------------------…

Quote of the day

Image
"As a matter of fact, the world does revolve around [me]."
~Nicolaus Copernicus


What great human beings need: Solitude

Image
This is just my extension to the original article on The Atlantics, What Great Artists Need: Solitude.



Sweet memory

Image

Alright, It's weekend!

Image
Code Quality


Source: http://xkcd.com/1513/

Add custom javascript to your WordPress theme without touching the template code

Image
Sometimes you want to add some custom effect to your WordPress template but don't want to make any changes to the theme code. Here you go, use this New Custom Javascript Editor plugin in your WordPress instance:

Github repository: https://github.com/dangtrinh/Custom-Javascript-Editor

1. Install

$ cd /path/to/your/wordpress/doc/root/wp-content/plugins
$ git clone https://github.com/dangtrinh/Custom-Javascript-Editor

2. Activate the New Custom JavaScript Editor in your WordPress Admin Dashboard

3. Go to Appearance >> Custom JavaScript or this url: http://yourdomain.com/wp-admin/themes.php?page=custom-javascript

4. Add your custom javascript and click Update





W3 Total Cache error: FTP credentials don't allow to write to file /etc/nginx/nginx.conf

Alright, I guess all of you guys get this error at least once in your life just like me the other days. I was searching around the Internet and found a lot of how-to guides but It did not work for me. Finally, I found out what caused the error of my WordPress instance:

I set the Nginx server configuration file path of W3 Total Cache (>>Performance >> General Settings) as /etc/nginx/nginx.conf which is not writable by the www-data user. So, I set the path to /var/www/nginx.conf (default), save the settings and everything is fine now.

Awesome!

Get last published posts in your entire WordPress Multisite network

To display last published posts from the entire network on the main blog of your WordPress Multisite, you can use this plugin I wrote (*) yesterday:

Github repo:https://github.com/dangtrinh/WordPress_Multisites_Utilities_Plugin

1. Install the WordPress Multisite Utilities Plugin:

$ cd /var/www/your_wordpress_installation/wp-content/plugins
$ git clone https://github.com/dangtrinh/WordPress_Multisites_Utilities_Plugin

2. Activate the plugin for your network (network only)

3. In your home page template file (for example page-home.php), call the get_recent_network_posts function to get latest posts (6 posts by default) from your network. For example:

<?php
$lastposts = get_recent_network_posts();
foreach( $lastposts as $post):
?>
<div class="col-1-3">
<div class="blog-post">
<div class="blog-post-thumbnail" style="background-image: url('<?php echo $post['thumb_url'];?>')"></div>
<a href="<?php echo…

#500 - Get post's featured image from any post in your WordPress Multisites network

To get post's featured image from any post in your WordPress Multisites network, use this function:



For example, get the featured image of post_id 2 of blog_id 3:

<?php $myfeaturedimage_src = wp_get_post_featured_image_src(2, 3, 'full')[0]; ?>

<img src="<?php echo $myfeaturedimage_src; ?>">


References:

[0] Original author:https://gist.github.com/bamadesigner/f5a338805d28f9c15df7
[1] Backup link: https://github.com/dangtrinh/WordPress_Multisites_Utilities_Plugin/blob/master/ssis_blog_plugin.php


Notes:This is my 500th post!!!

Format datetime string in php

Assuming you have a string represents some datetime:

$mydatetime_str = 'Oct 20 18:29:50 2001 GMT';

dTo reformat the above datetime string to mm/dd/yyyy, use this:

$newdatetime_str = strftime("%m/%d/%Y", strtotime($mydatetime));


For more details about strftime: http://php.net/manual/en/function.strftime.php

Linux server's datetime is wrong and how to fix

Use this when your Linux server's datetime is wrong. Basically, all you have to do is sync with a reliable NTP server (ex. my-ntp-server.com):


1. First, make sure the server is set with the right timezone (ex. Asia/Ho_Chi_Minh):

$ sudo dpkg-reconfigure tzdata

2. Sync it with a local NTP server:

$ sudo ntpdate my-tp-server.com

The Time on the Linux server should be correct now.

3. Furthermore, you can install ntpd. It synchronizes the clock for you, doing so continuously in the background:

* Install ntpd:
$ sudo apt-get install ntp

* Config ntpd:
$ sudo nano /etc/ntp.conf

* Add your reliable NTP server:
server my-ntp-server.com

* Restart ntpd:
$ sudo service ntp restart


MySQL does not start automatically at system startup/reboot in Ubuntu 14.04

For some reason, after the Ubuntu 14.04 server rebooted, my MySQL service did not start automatically. So I decided to restore the default upstart script of MySQL and everything's back to normal now:

$ sudo update-rc.d mysql defaults


PyCon 2015

I can't believe that a year has gone by. My days in Montreal last year is just like last weak. Everything came back to me when I saw a post on HackerNews about PyCon2015:

Official website:http://us.pycon.org/2015/

Videos:https://www.youtube.com/channel/UCgxzjK6GuOHVKR_08TT4hJQ

This year, I don't attend the conference because I have another plan. But, the conference's atmosphere is so excited to me. I will watch all the clips and may learn something like last year.


How to calculate age from date of birth in Excel or LibreOffice Calc

To calculate the age from date of birth in excel, use this formula in column B (assuming I have the Date Of Birth data in column A):

=DATEDIF(A2,TODAY(),"Y") & " Years, " & DATEDIF(A2,TODAY(),"YM") & " Months, " & DATEDIF(A2,TODAY(),"MD") & " Days"

    | A                |  B               |
1  | DOB          | Age            |
    |---------------|---------------|
2  |04/28/1989  |                    |
    |---------------|---------------|
3  |12/08/1988  |                    |
    |---------------|---------------|


If you want to calculate age at a certain date, for example 08/12/2015, use this:

=DATEDIF(B2,DATE(2015,8,12),"Y") & " Years - " & DATEDIF(B2,DATE(2015,8,12),"YM") & " Months"

What an afternoon!

Image