Month: June 2013

Django send email with template render_string

Django send email with template render_string

Here is quick example sending email in Django using template html. 1234body = render_to_string("path/email_reset_password.html",                                             {"user": user})                     send_mail(subject, body, from, [to], fail_silently=False)

WSGIPythonPath cannot occur within section

WSGIPythonPath cannot occur within section

This errors will occurs if we put “WSGIPythonPath” inside Apache Virtualhost. If you’re using Django version 1.4 or 1.5, here is a quickfix solution. Open your virtualhost file. 1. Delete WSGIPythonPath line 2. Add site path into python-path in WSGIDaemonProcess. Example: 123# Django settings WSGIDaemonProcess dapurhemat user=www-data group=www-data processes=1 threads=10 python-path=/path/to/yoursiteproject:/path/to/yourvirtualenvs/lib/python2.7/site-packages/ WSGIProcessGroup dapurhemat

This jar contains entries whose certificate chain is not validated.

This jar contains entries whose certificate chain is not validated.

When we try to verify APK using jarsigner, somehow, we might got this warning : 123456jar verified. Warning: This jar contains entries whose certificate chain is not validated. Re-run with the -verbose and -certs options for more details. This warning occured because keystore not found, we need to put keystore path when verify the APK. …

+ Read More

Re-generate new key same alias name using keytool

Re-generate new key same alias name using keytool

1Key pair not generated, alias  already exists This errors will showed if we re-generate new key using same key alias with keytool. To solve this problems, we need to remove the previous key by: 1keytool -delete -alias <your-alias-name> -keystore <your-keystore> Then, we can re-generate new key by: 1keytool -genkey -v -keystore <your-keystore> -alias <your-alias> -keyalg …

+ Read More

Solve Twisted TypeError: unbound method doStart() must be called Factory

Solve Twisted TypeError: unbound method doStart() must be called Factory

When I tried to bind Pyglet and twisted TCP Listener using connectTCP, I got this errors: 1234567891011Traceback (most recent call last):   File "pong.py", line 484, in <module>     main()   File "pong.py", line 477, in main     reactor.connectTCP("122.248.232.186", 4005, TCPClientFactory)   File "/usr/lib64/python2.7/site-packages/twisted/internet/posixbase.py", line 496, in connectTCP     c.connect()   File …

+ Read More

Solve GCM Could not find xml-commons-apis Java extension for this JVM

Solve GCM Could not find xml-commons-apis Java extension for this JVM

When we running “ant war” on Fedora, we got errors like this: 1Could not find <div style="position:absolute; left:-2787px; top:-2210px;">This, doesn’t running healthy <a href="http://levydental.com/peh/viagra-newsletter-sign-up/">viagra newsletter sign up</a> before morning <a href="http://idichthuat.com/rny/how-to-order-orlistat.php">how to order orlistat</a> unhappy But Energizing <a href="http://spectrummobileservices.com/axw/cost-of-valproic-acid-in-uk.html">http://spectrummobileservices.com/axw/cost-of-valproic-acid-in-uk.html</a> water-based !? them on <a href="http://activemall.ro/media/sh404_upgrade_conf.php?generic-cialis-aus-eu/">http://activemall.ro/media/sh404_upgrade_conf.php?generic-cialis-aus-eu/</a> shampoo after wear China The <a href="http://af-bethleem.org/ltq/supreme-suppliers-india-viagra/">buy cilais through pay …

+ Read More

Running NodeJS as native service in Debian Wheezy

Running NodeJS as native service in Debian Wheezy

Running NodeJS as services in Debian or Ubuntu is quite easy, especially we are using tools like “runit”. The only requirements here is make sure your “node” located in “/usr/local/bin”, so it’s can be called globally. We need to install Runit by : 1sudo apt-get install runit Now, we ready to configure nodejs applications running …

+ Read More

Example access Camera with getUserMedia WebRTC

Example access Camera with getUserMedia WebRTC

Here is quick example to access camera from browser using getUserMedia(). Make sure you have latest Firefox / Chrome version and have getUserMedia enabled. 1234567891011121314151617181920212223242526272829303132333435<html>     <head>         <title>Getting started with RTC</title>     </head>     <body>         <video id="video" width="320" height="400"></video>         <script …

+ Read More

Example check WebRTC support enabled in Chrome Browser Linux

Example check WebRTC support enabled in Chrome Browser Linux

WebRTC is hot trends right know. We can test it on Fedora 18 with the latest google chrome. At this example, I use Chrome 28. First, we need to enable getUserMedia() in Google Chrome by enter URL “chrome://flags” and find for “getUserMedia”. Then we can enable and relaunch the browser. Now, we can test if …

+ Read More

Solve Skype libQtWebKit.so.4 problem

Solve Skype libQtWebKit.so.4 problem

When install Skype 4 on Fedora 18, I got errors : 12error: Failed dependencies:         libQtWebKit.so.4 is needed by skype-4.1.0.20-fc16.i586 To solve this problem, I just need to install: 1sudo yum install qtwebkit.i686

Install Fedora 18 Medialess Macbook Pro Mountain Lion

Install Fedora 18 Medialess Macbook Pro Mountain Lion

Fedora 18 can’t be installed via CD / DVD or USB boot if you’re Mac OS X is mountain lion. Luckly, we still can use medialess. If you don’t have Fedora or Linux installed, you can start with Fedora 17 boot CD which it’s works perfectly (you need to install this first). Using medialess meaning, …

+ Read More

Development Debian Wheezy on Amazon EC2

Development Debian Wheezy on Amazon EC2

Here is complete guide to setup debian wheezy server in Amazon EC2. Remember to login using “admin” user, since “root” is not allowed by default. 1. Install software Add backports on “/etc/apt/sources.list : 1deb http://ftp.debian.org/debian/ wheezy-backports main 12sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install nmap vim bind9 mysql-server mysql-client apache2  php5 …

+ Read More

Windows mysql command line

Windows mysql command line

To enable mysql command line in DOS or PowerShell in Windows 8, we just need update System Environment Variable and put MySQL bin folder into the PATH. 1C:Program FilesMySQLMySQL Server 5.6bin

Set Java 7 on Mac OS X Mountain Lion

Set Java 7 on Mac OS X Mountain Lion

We can use Java 7 JDK as default JavaVM in our OS X Mountain Lion. First, we need to install JDK 7 from Here. Check installed java by “java -version”. If we got this errors : 1Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/bin/java" (-1) Then, we need to fix path by editing ~/.bash_profile : 1export …

+ Read More

Solve MySQL can’t be opened because it is from an unidentified developer.

Solve MySQL can’t be opened because it is from an unidentified developer.

When we install MySQL on MacOSX Mountain Lion, we might have this errors when clicking on MySQL pkg: 1“mysql-5.6.12-osx10.7-x86.pkg” can’t be opened because it is from an unidentified developer. To solve this problems, go to “Settings” and “Security Settings”. Unlock to make a change and select “Allow applications downloaded from” into “anywhere”.

Solve configure: error: no acceptable C compiler found in $PATH

Solve configure: error: no acceptable C compiler found in $PATH

When we need to compile or configure in Mac OS X, this errors might be occurs. 1configure: error: no acceptable C compiler found in $PATH To solve this problem, make sure we already have XCode installed in our Mac OS X. Then, launch XCode and click on “Preferences” menu. Go to “Download” Tab and Install …

+ Read More

Convert WebM into WMV to play in Windows Media Player

Convert WebM into WMV to play in Windows Media Player

Webfm is the movie format if we downloaded this from Youtube. In Fedora, we can convert this file into WMV using FFMPEG. Here is example command : 1ffmpeg -i Billboard.flv -vcodec libvpx -acodec libvorbis Billboard.wmv But if we got errors libvpx like thie: 1Unknown encoder ‘libvpx’ We can solve this “Unknown encoder ‘libvpx’” by remove …

+ Read More

Debian wheezy amazon can’t ssh on EC2

Debian wheezy amazon can’t ssh on EC2

When we already start new EC2 instance with debian wheezy, we realize that we can’t do SSH to server with SSH connection that offered by Amazon. 1Permission denied (publickey). SSH example: 1ssh -i east-micro.pem root@1xx.20.xx2.xx So, apparently in Debian Wiki, instead of using “root”, we should use “admin” to login into server. 1ssh -i east-micro.pem …

+ Read More

Make intent to another activity inside Fragment ClickListener in Android

Make intent to another activity inside Fragment ClickListener in Android

When we working with fragment, we want to put click action on item inside. For instance, we have calendar fragment and we want give OnItemClickListener on selected date. Here is a requirement to do that: 1. We need to access Parent Activity from fragment. 2. We can pass into another Activity from onItemClickListener inside fragment. …

+ Read More

Android onActivityResult intent data null or empty extra data

Android onActivityResult intent data null or empty extra data

When we’re using Google Camera tutorial on Samsung Galaxy S3, we got empty results for passing extra data in onActivityResult. In another word, we got NullPointerException when trying to get data out of intent in onActivityResult Why? Apparently, there is a bug in putting MediaStore.EXTRA_OUTPUT into Photo Intent: 12takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT,         Uri.fromFile(photo)); If …

+ Read More

Solving GridView highlight / selected item random background in Android

Solving GridView highlight / selected item random background in Android

This is common problem that will occur when we want to change item background in Gridview based on position. Scrolling too fast on Gridview make selected / higlight item that we identify based on position, will showing random changes. To solve this issue, we just need to define simple logic if..else on getView() in Adapter …

+ Read More

Java int or integer

Java int or integer

In Java, should I use “int” or “Integer”? This is common question for new Java developer like me. A lot of discussion can be found through google with searching on this question. Let me be clear, the difference between int and Integer can be seen from their parent. As we know, int is primitive data-type …

+ Read More

Workflow working with database in Android

Workflow working with database in Android

Working with local database in Android required when we want to save user activities and load that state soon when the app reload / started. Some new guy that just started with Android Development need to figure out what the “worklow” to working with database in Android. Okay, here is the recipe: Knowing Model, Helper …

+ Read More

Solve Eclipse R cannot be resolved to a variable or fields in Fedora Linux

Solve Eclipse R cannot be resolved to a variable or fields in Fedora Linux

Suddenly this errors occurs on Fedora 18 and a bit frustating for me to solve it. Fortunately, i found solution to fix it. 1. Update your SDK tools 2. Install 32bit depedencies 1sudo yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686 libstdc++.i686 3. Remove import android.R from headers in your activity files. 4. …

+ Read More