OS

Solve .gitignore not ignoring .classpath & project.properties in Windows

23 Aug , 2013  

I have this small problems when Git not obeying .gitignore in Windows. It’s keep adding .classpath and project.properties.

To solve this problem:

1
git update-index --assume-unchanged <file>

OS

Mysql drop all databases

13 Aug , 2013  

Here is a quick mysql script to drop all databases except test and information schema :

Go to mysql command-line and execute this :

1
select group_concat(concat('drop database `',SCHEMA_NAME,'`;') SEPARATOR ' ' ) from information_schema.schemata where SCHEMA_NAME !='mysql' and SCHEMA_NAME !='information_schema';

,

OS

Solve Java Application killed / closed in Ubuntu 13.04 Raring

13 Aug , 2013  

After update Ubuntu 13.04 Raring, suddenly all Java based application like LibreOffice, Aptana, Eclipse, Netbeans get killed / closed without any-reason.

To solve this :

1
sudo apt-get remove libwebkitgtk-1.0-0

Kudos to :
http://daddycat.blogspot.com/2013/05/when-eclipse-is-killed-after-ubuntu.html

Django

Django Admin read GET params and set value object in add form

12 Aug , 2013  

Here is quick snippet to read GET params value and set add form value by it’s GET value

1
2
3
4
5
6
7
8
9
10
11
12
13
class PhotoAdmin(admin.ModelAdmin):
    ...

    def add_view(self, request, form_url="", extra_context=None):
        data = request.GET.copy()

        if request.method == "GET" and "item_id" in request.GET:
            data['item'] = Item.objects.get(
                                       id=request.GET["item_id"]
                                   )
        request.GET = data
        return super(PhotoAdmin, self).add_view(request, form_url="",
                                                extra_context=extra_context)

,