Posts

Showing posts from 2012

Increasing the file upload limit in php and phpmyadmin

# Open the php.ini with favorite text editor sudo gedit /etc/php5/apache2/php.ini # Change the value of these fields according to your needs memory_limit post_max_size upload_max_filesize # Restart apache sudo /etc/init.d/apache2 restart and you are set.

Apache, PHP, MySQL, PhpMyAdmin installations in Ubuntu

Update list of available packages: sudo apt-get update To install apache2 server:  sudo apt-get install apache2   To start apache server for testing: sudo /etc/init.d/apache2 restart   Go to http://localhost/ You should see a It Works! page To install PHP:  sudo apt-get install php5   To install MySQL:  sudo apt-get install mysql-server Set a password when prompted To check installation, issue the command mysqladmin To install phpmyadmin: sudo apt-get install phpmyadmin select apache when prompted for web-server configuration when prompted for phpmyadmin configuration, select no after installation, run the following command sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d restart apache and goto localhost/phpmyadmin to test the installation  

Using same template for add and edit using Django Model Form

If we want to use a customized form corresponding to a ModelForm, we have to do something like this <form action="" method="post"> <input name="{{form.field_a.html_name}}" type="text" /> <input type="submit" value="Submit" /> </form> This will work fine for adding data. But it's very common that we want to use this same form for updating data. In that case we have to populate the fields of the form with the existing data. We may want to do something like this <form action="" method="post"> <input name="{{form.field_a.html_name}}" type="text" value="{{form.field_a.value}}" /> <input type="submit" value="Submit" /> </form> But this may create some problem. If the field is optional and contains no data, in our generated html form, the value of that field will be "None". Surely, this is not

Useful Linux Commads

Delete files having specific extension recursively find /home -iname "*.mp3" -exec rm {} \;

Django With POSTGRESQL in Ubuntu

The first step is to change the database engine in the application’s settings.py file: 'ENGINE': 'django.db.backends.postgresql_psycopg2' Running  python manage.py syncdb  returned the following error: Error loading psycopg module: No module named psycopg I’ve tried installing the psycopg2 package, but that resulted in another error: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application The libpq-dev package had to be installed to meet all the dependencies: sudo apt-get install libpq-dev sudo pip install psycopg2 But still, the syncdb command wasn’t returning the desired result: Peer authentication failed for user "someuser" I needed to open up the file /etc/postgresql/9.1/main/pg_hba.conf in a text editor (with root privileges) and change this line: local   all             all                                     peer to this: local   all             all               

"Server could not process your apk" problem

Image
After completing the development and the signing process of the application on which I'm working , I was trying to upload it in the Google Play. But I was getting this error The server could not process your apk. Try again After Googling for sometime, I came to know that this error arises when there is a problem in the manifest file included in the apk. From Android developer forums, I came to know that this problem is not happening only to me. Many developers are facing this problem. In my case, the reason behind the problem was very peculiar. In my manifest file, one of my activities was declared like this                  <activity             android:name=".views.user.ChangeEmailFormActivity"             android:label="Change Email Address"             android:theme="@android:style/Theme.Dialog"              android:icon="@android:drawable/ic_dialog_alert" >       </activity> This was creating the problem(?).

Integrating Python and Apache

Today I'm going to write on how to integrate Python with apache web server. All you probably know that Python is also a server side scripting language. So, like PHP and other server side scripting languages, you can use Python in the same way. This is not tough, just a matter of some minutes. Okay, before you start the tutorial, you must (most probably already you have) have the following installed in your computer/server. 1. Apache web server (Only apache or xampp, wamp etc anything containing apache will do). I'll use xampp as reference but others should behave the same 2. Python (I'm using 2.7) So, if you don't have these two installed, download and install them first and then continue As you are here, you have already installed apache/xampp/wamp and Python. Follow these steps 1. Go to your apache folder. In my case, as I'm using xampp it's in location C:\xampp\apache 2. Go to the conf folder and open the httpd.conf using a text editor. I pref