Month: October 2014

Github keep tracking and what is for ?

Github keep tracking and what is for ?

When working with github, we usually do “push” and “pull” followed by “origin master” or “origin branch-name”. We can just use “git pull” or “git push” and will followed by the current branch. For global push config using current: 1git config –global push.default current Example, we currently at branch “dev”. To push update, we can …

+ Read More

No python application found, check your startup logs for errors

No python application found, check your startup logs for errors

This errors occured in setup Django + UWSGI in Ubuntu 14.04. The reason because the uwsgi from aptitude is broken. 1234Sat Oct 25 12:38:28 2014 – — no python application found, check your startup logs for errors — [pid: 5556|app: -1|req: -1/1] 36.78.164.116 () {42 vars in 681 bytes} [Sat Oct 25 12:38:28 2014] GET …

+ Read More

Django UWSGI Ubuntu 14.04 in Amazon EC2

Django UWSGI Ubuntu 14.04 in Amazon EC2

Here is complete tutorial installing and setup django for production in EC2 Ubuntu 14.04. First, we need to login into EC2, setup a new instance and launch. Then login SSH and ready for action. 1. Always get latest updates 1sudo apt-get update && sudo apt-get upgrade -y 2. Install Java 1234sudo apt-get install python-software-properties sudo …

+ Read More

Remove dash or empty label in Django Form ForeignKey

Remove dash or empty label in Django Form ForeignKey

To remove dash or empty selection in form foreignkey Django, we just need to declare “empty_label=None” in the form. Here is the example : 1234instance = forms.ModelChoiceField(empty_label=None,                 queryset=Instance.objects.exclude(                    …some queryset..                 …

+ Read More

Solve office 2013 can’t open document problem

Solve office 2013 can’t open document problem

I can’t open document from email. Apparently it because permission issue. The solution, open notepad and copy-paste this code: 12345678910111213141516171819Windows Registry Editor Version 5.00   ; Fixes for Microsoft Office 2013 error when trying to open a document from the Internet ; by WindyLea   [HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView] "DisableInternetFilesInPV"=dword:00000001 "DisableAttachmentsInPV"=dword:00000001 "DisableUnsafeLocationsInPV"=dword:00000001   [HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView] "DisableInternetFilesInPV"=dword:00000001 "DisableAttachmentsInPV"=dword:00000001 "DisableUnsafeLocationsInPV"=dword:00000001   …

+ Read More

Django coercing to Unicode: need string or buffer, NoneType found

Django coercing to Unicode: need string or buffer, NoneType found

This errors in Django ‘coercing to Unicode: need string or buffer, NoneType found’ take me 20 minutes to solved. Look at our example models : 12345class Insurance(models.Model):     code = models.CharField(max_length=255, blank=True, null=True, default=None, unique=True) class Person(models.Model):     insurance = models.ForeignKey(Insurance) When insurance value is None, then you will get error : 1coercing …

+ Read More

Setup pgpass in Windows

Setup pgpass in Windows

To setup pgpass in windows, please go to : 1C:\Users\<your-user>\AppData\Roaming Create “postgresql” folder and create pgpass.conf file inside. 1localhost:5432:*:postgres:<your-password>

Add error in django form in views

Add error in django form in views

Here is an example how to modified or add errors in Django Form using views: 123error_message = "Wrong password" errors = form._errors.setdefault("password", ErrorList()) errors.append(mark_safe(error_message))

Setup Django 1.7, Haystack and ElasticSearch

Setup Django 1.7, Haystack and ElasticSearch

Installing Django, Haystack and ElasticSearch is easy. But then i found problems which using Elasticsearch, my search results is empty. Also i have several headache problems like SearchQueryset returning 0 meanwhile indexing multiple apps is working. Anyway, here is the correct way to setup Django, Haystack and ElasticSearch. 1. Django We need to install elasticsearch …

+ Read More

Solve Skype Problem after changed computer date

Solve Skype Problem after changed computer date

This is weird! When i changed my computer date, suddenly i can’t send message in conversation. To solve this issue, first download SQLiteBrowser for Windows http://sourceforge.net/projects/sqlitebrowser/?source=typ_redirect Then, go to : 1C:\Users\<Your User>\AppData\Roaming\Skype\<your-skype-account> Edit “main.db” with SQLitebrowser. Go to browse data and select messages. Now delete messages that more than the date in your computer. Solved!

Solve Aptana Unresolved import Django

Solve Aptana Unresolved import Django

For quick solution add both “site-packages” and your projects into your PyDev Python Path. Then delete .project and .pydev in your project. Re-import your project and it’s must be solved!

Solve soffice error python django in server

Solve soffice error python django in server

When execute soffice from python, i got this errors : 123456[Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx [Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx The solution is change uwsgi ini to execute django using “ubuntu” (user) instead …

+ Read More

Beware Django Query Filter update() not using save validation

Beware Django Query Filter update() not using save validation

Always remember when using this script : 1Member.objects.filter(…).update({‘phone’: ‘082343-324234’}) If you have validation or rules in Model save(), then it will not being called. REMEMBER that update() in filter will not emit any signal and pass save model. To update model with kwargs, we can use : 12 instance.__dict__.update(member)  instance.save()

Django how to reset app table using migration

Django how to reset app table using migration

This is simple tricks to reset app table or solve default field value. 1. Commented all app below your app in settings.py 2. Commented your app model 3. Makemigration to generate migration that delete your app table 4. Un-comment and add modification 5. Makemigration to generate migration that create your app table Example: I have …

+ Read More

Django 1.7 python standalone scripts

Django 1.7 python standalone scripts

Here is a guide to set standalone python scripts in Django 1.7. Fyi, here is my project structures : 123456project_name    |__ app         |__ __init__.py         |__ standalone.py         |__ models.py         |__ views.py Then my standalone script be like: 12345678910import sys …

+ Read More

Trick reset django app migration

Trick reset django app migration

When you have mistakes and you want to reset table with django migration, think this way 1. Delete all tables By commented all model in your app and disable any apps below your app in settings.py 2. python manage.py makemigrations your-app This will generate migration to remove all your app tables 3. un-comment your models …

+ Read More

Setup Python and PIP in Windows Server

Setup Python and PIP in Windows Server

Please follow this link for patching your Python : http://stackoverflow.com/questions/3652625/installing-setuptools-on-64-bit-windows For me, since i have Python already in another drive, i just need to update “System Environment” and add : 1C:\Python27\;C:\Python27\Scripts;

Django admin with grappelli delete data error

Django admin with grappelli delete data error

When using django admin with Grappelli and delete data, i got this errors : 12NoReverseMatch at /backoffice/documents/document/ Reverse for ‘app_list’ with arguments ‘()’ and keyword arguments ‘{u’app_label’: ”}’ not found. 1 pattern(s) tried: [u’admin/(?P<app_label>membersauth)/$’] The solution, you just need to upgrade your django-grappelli

Django unique True with blank True

Django unique True with blank True

In Django, we can set field with unique=True. But when we want to make the field as optional, we usually think about blank = True which lead to problems. The solution is using default=None 1email= models.CharField(max_length=255, blank=True, null=True, default=None, unique=True) And in modelform, we can put this : 123# UNIQUE if NOT NULL def clean_email(self): …

+ Read More

IBM BPM Process Designer blank screen solved

IBM BPM Process Designer blank screen solved

When running BPM Process Designer, it will going blank in Windows 8. Here are the solutions : 1. Go to the directory where Process Designer is installed and find the javaw.exe file. For me this directory is: C:\IBM\ProcessDesigner\v8.5\AppClient\java\jre\bin 2. COPY the file javaw.exe to javawpd.exe. You will now have 2 copies of this file. 3. …

+ Read More

Setup Windows Server 2012

Setup Windows Server 2012

Here are guide to setup windows server 2012 R2 for development. 1. Enable Wifi Open PowerShell and execute : 1add-windowsfeature wireless-networking And reboot. 2. Enable Sound Run “services.msc” and right click on “Windows Audio” and select “start”. Right click and select properties, changes into Automatically to enable it permanently. 3. Install NET 3.5 Go to …

+ Read More

Bootable usb windows from iso

Bootable usb windows from iso

We can convert Windows 8 / Windows Server 2012 ISO into Bootable USB. First thing, we need to have the ISO. Then please download Windows 7 USB/DVD Download Tool: http://www.microsoftstore.com/store/msusa/html/pbPage.Help_Win7_usbdvd_dwnTool Install the software and open it. Then, prepare USB 8 GB at least and make sure to format using FAT32. This is important, since UEFI …

+ Read More

Setup Git in Windows 8

Setup Git in Windows 8

Here are quickstep to setup git in windows : 1. Download git from http://git-scm.com/download/win 2. In Installation, make sure to enable git and linux command in command prompt (yes, the red text) Now, git can be accessed from your command prompt. Next step is generate ssh key for windows. Go to git bash (you can …

+ Read More