Posts

Showing posts from July, 2013

Plone - Review documents in Plone with documentviewer

Image
To enable Plone to be able to review my uploaded documents, I will install the documentviewer addon. Addon URL: http://plone.org/products/document-viewer Following these steps:

Vagrant - Start-up VM without provisioning

Just run the vagrant command with `--no-provision`: $ vagrant up --no-provision

Plone - Up and Running with Vagrant

Image
I was looking for a Document Management System written in Python, and I found Plone. Genius! Plone is a CMS but It has so many features and plugins so I can make it a DMS easily. Just amazing! There is an easy way to deploy a Plone instance. It's via vagrant. Just follow these following steps:

Wordpress - How to change language in Hosting service

It's just really weird that when I deploy my wordpress site on to the hosting service, the language of the site is still English (the default), and the qtranslate plugin did not work. Thing is everything is just OK in my laptop. What's wrong with the host? And, I figure out that I have to define the language directory of my wordpress site, and everything is OK: define('WPLANG', 'vi'); define('WP_LANG_DIR', $_SERVER['DOCUMENT_ROOT'].'/wp-content/languages');

edX-platform - Another way to activate user account in dev environment

Image
In development environment, when creating an user account, you need to verify that account. The verification email will be logged to the console, so you can take a look at the terminal and get the activation url ( click here to see the edx's instruction ). But if you can't see that link, you can do the following: 1. Create a superuser account: rake django-admin["createsupseruser"] 2. Login to the django admin app of LMS (through the url "http://192.168.20.40:8000/admin" or in my case I used the url "172.25.20.82:9000/admin" to access the machine that running the edx-platform) by the superuser account, and check Active status for the user you want to activate:

edX-platform - Remove the error phantomjs is not found.

You will see a blue warning message when starting the LMS or CMS: " p hantomjs not found on path. Set $PHANTOMJS_PATH. Using browser for jasmine tests " It's not something fatal, but I want to get rid of it :D Here is how i did it: 1. Inside the VirtualMachine (vagrant ssh), cd to /opt/edx/edx-platform/node_modules/ and install phantomjs : sudo npm install phantomjs -g phantomjs will be installed inside the node_modules dir. Change permission for the phantomjs dir: sudo chmod 755 phantomjs 2. Include the phantomjs path to your PATH: add this line to the end of ~/.bashrc : export PATH=$PATH:/opt/edx/edx-platform/node_modules/phantomjs/bin eval "$(rbenv init -)" And no more warning / error about phantomjs. Updates July 24, 2013: Pull the latest source code from master and you only need to install the phantomjs, and everything will just be fine: `sudo npm install phantomjs -g `.

edX-platform - Using the LMS and CMS - July 23, 2013

Image
After deploying the edX-platform, I now can experiment the LMS and CMS (the Studio). 1. Create a course: here are some basic steps and notes a/ In the Studio (192.168.20.40:8001, in my case, I use 172.25.20.82:8001), login and create a course: b/ Change settings for the course in Settings >> Schedule & Details :

edX-platform - Up and Running in Vagrant environment

Image
After a while messing around with edX platform source code (http://iambusychangingtheworld.blogspot.com/2013/06/edx-source-code-exploration.html), I decided to run the platform using the recommended way, the Vagrant way. I followed the instructions from the edx-platform repo: https://github.com/edx/edx-platform#installation---the-first-time. But, there're something I had to do to make it work: 0. My computer (CPU) has to support virtualization technology or the vagrant environment will not run or hang forever :D. So, CPU core i3, i5 +... is fine .

ORACLE - Get updatable columns of a table

Image
If you want check if a table in your Oracle database can be update, insert or delete, you can use the following query: SELECT * FROM USER_UPDATABLE_COLUMNS WHERE TABLE_NAME='STUDENTS'; And you'll get something like this:

SQLAlchemy - MySQL has gone away

In the previous blog post, I showed you how to use Django's Form with SQLAlchemy to manipulate MySQL db . There's something annoying me a lot after the day I post that article,  that's is the error: "MySQL has gone away" What's the...? I refreshed the page after an idle time, and the error appears from nowhere?! And if I refresh again, the app will load beautifully. What's going on here? It seams like that is the common error when working with SQLAlchemy, and If you don't manage the session carefully and appropriately. The most common reason is the SQLAlchemy's session is still open while the connection to MySQL server timing out. So here are what I have to do with my_db_utils.py:

"If you give a little love you can get a little love of your own"

Django + SQLAlchemy - Make use of Django Forms

Imagine, you have a MySQL database table which is used by a web application (let's call it App-A). And you want to create a web interface to modify data of that table, but you don't want to tough the source code of App-A. In this situation, I will choose Django and SQLAlchemy. Your table in App-A is something like: MyGeniusTable: - id: INT(10) - name: VARCHAR(255) - value: VARCHAR(255) and we already have 2 records in MyGeniusTable: + name = 'my_first_data_name' / value = 'super' + name = 'my_second_data_name' / value = 'genius' We will build a Django app to modify those records above: 1. Create a Django project named MyGeniusProject , and an app named MyGeniusApp . The directories structure is:

Active Directory DC - How to solve error 8614 and eventID 2042

Image
One day, you wanna rename a domain controller in the forest just like me did a couple days ago. You wanna make sure everything OK before making any changes to the system using  repadmin tool (included in Windows Server 2008): > repadmin /showrepl But, a domain, called it DC-A, in the forest raises the 8614 error indicates that: "The Active Directory cannot replicate with this server because the time since the last replication with this server has exceeded the tombstone lifetime" Oops...! In this situation, to troubleshoot, I suggest that you should use 2 tools of the Windows server environment:

Window$ - How to increase the size of the cmd window.

Image
It's just absolutely annoying when I have to work with the Windows's command prompt windows because of its limited size. To increase the size of the command prompt window of M$ Windows: 1. Right click in the control bar of the windows, choose Properties:

Ubuntu 12.04 and later - What to do when network-manager does not start automatically

If you turn on your Ubuntu machine and the network indicator in the system tray does not show up, it's because the network-manager service didn't start. To fix this issue, modify the  /etc/network/interfaces file, comment out all the lines but two following lines: auto lo iface lo inet loopback Reboot, and it's done.

Android - How to change proxy

Image
At the yesterday Barcamp Saigon event, I's trying to connect to the wireless network. They said that I have to change the proxy settings of the network device (my phone). They also gave me the instructions how to modify the proxy of my phone. But, they're only about iPhone, iPad, Windows... and It sucks! I use Android. I didn't know how to change the proxy settings of my little Android back then. But, now I figured it out:

Me @Barcamp Saigon July 2013

Image
"The fewer people care about it, the more I feel I'm special" Barcamp is always crowded of people. The last Barcamp Saigon (2012) is so boring (venue, topics..). But, this year, I gave it a try. I also decided to present about what I'm interested in, and what I'm working on right now, Django. Btw, I've just messed around with Django for 6 months , so do not expect something too advanced, I'm still a learner. There're not so many people know about Django, but there're still some guys curious about that cool framework, more than i expected. In this presentation, I just want to introduce people about the Django's architecture, and a practical example of building an Django web app. The main parts of my presentation are: * Part 1: Introduction to Django:

Android - Remote control your Computer with RemoteDroid

Image
I've just found a great Android app which make my touch phone become a keyboard and mouse to control my Ubuntu PC. It's is RemoteDroid. * Firstly, download and run the server app on your machine:  http://remotedroid.net/

Javascript - Delay the execution a function

If for some reasons you want to delay the execution of a javascript function, you just need to use setTimeout, the pure built-in javascript function which is compatible with all browsers: * Function without parameters: setTimeout(function_name, 1000); * Function with parameters: setTimeout(function() { function_name(params) }, 1000);

Django, Celery: Display the progress bar of the current executing task

Image
I'm using Celery ( http://www.celeryproject.org/ ) to do the users's long-running task in Django. It eases the users by not let them wait the process done. When a user call the action (the view to execute a certain task), Django immediately response back to the user and it's done. The  job which has to be done was sent to the message broker where it will be actually executed. We all know all of the things mentioned above. Question is "How does the user know when the task will finish?" Here is the solution: - In your task code, continuously updating state of the task (over a for loop) , define a custom state names PROGRESS - Writing an infinite loop of Ajax call in your template to check the state of the current process and update the progress bar. I also make a complete and simple example to implement the above idea, call testcele project (and create  celery app inside testcele project). The main (and only) functionality of testcele is that it