How to fix django runserver ‘port already in use’ error

This usually happens if you  $ python runserver 8000 and then don’t stop the server by hitting Cntrl+C but hit something like Cntrl+Z instead.

To stop the server on port 8000 so that you can run another instance again you can do the following..

Run the below command to list all your processes with ‘manage’ in their name.
$ ps aux | grep -i manage

Note the process_id (pid)  for our “ runserver” process which should be the second column from the left.

And then simply run
$ kill -9 <pid>

e.g. $ kill -9 30144


Yorum bırakın

Filed under Django

How to install and integrate Django Suit to Django’s admin tool?

  1. You can get stable version of Django Suit by using pip or easy_install:

    pip install django-suit==0.2.15
    # or
    easy_install django-suit==0.2.15
  2. You will need to add the 'suit' application to the INSTALLED_APPS setting of your Django project file.:



'suit' must be added before 'django.contrib.admin' and if you are using third-party apps with special admin support (like django-cms) you also need to add 'suit' before 'cms'.

  1. You also need to add 'django.core.context_processors.request' toTEMPLATE_CONTEXT_PROCESSORS setting in your Django project file.:

    from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
Note: This is required to handle left side menu. If by some reason you removed original Django Suit menu.html, you can skip this.

Yorum bırakın

Filed under Django, Python

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.

This little sucker happens because Apple doesn’t love http anymore, they love https. But also not to make developers angry, they made it configurable. One can find it easily by googling it for a 5 seconds.

Here’s a screenshot from stackoverflow:

this is how you do it

Yorum bırakın

Filed under Swift

Searching String in Directory and Subdirectories With Python & Bash

I had mentioned two different approaches at first post on this subject (

And once again first approach proved it’s worthy of knowing. This is how i searched string in a directory:


import os
import subprocess
myString = str(raw_input('search key: '))
print myString
myCommand= 'grep -rl "' + myString +'" /Users/timuryildirim/Desktop/fortuna'
print myCommand
#result = subprocess.check_output([command])

Yorum bırakın

Filed under Bash, Python

Replacing character in string with Swift

It may look like a little thing that may not even worth to write on my blog but this little stuff just saved me tons of time and a huge panic attack while i was working on coding some http requests for a iPhone app. So here it is:

var newsParam = "Aston Martin"
var convertedNewsParam = newsParam.stringByReplacingOccurrencesOfString(" ", withString: "%20")
var webservicePath = "http://xx.xx.xx.xx:yy/myWebService?search_text=\(convertedNewsParam)"

Some may say, “Why don’t you request by using id?”. That’s what i said my colleagues but their code was working this way and they didn’t want to change it since it’s working. So, when i just copy-pasted url to Postman with request parameter as “Aston Martin” it was working fine but it was giving me this error message: fatal error: unexpectedly found nil while unwrapping an Optional value

But when i changed space charater to it’s html equivalent (which is “%20” as you see from the code) and change my request parameter to Aston%20Martin it sets us free from that fatal error.

Yorum bırakın

Filed under Swift

How to change language on Adobe CC to english? (On Mac)

*note: i tested this only on Photoshop

Just follow these steps:

  1. Close Photoshop or whatever you’ve opened
  2. Go to Finder > Preferences and check first checkbox (Show all filename extensions) and close the window
  3. Go to Finder > File > New File Window then select Applications
  4. Go to Adobe Photoshop CC > Locales > tr_TR > Support Files
  5. Rename the extension of .dat file to .bak

That should do the trick. Now when you opened your photoshop, it should be using English language

Yorum bırakın

Filed under Adobe

How to Load UIViewController programmatically with Swift?

Sometimes you may have to display a view with an element that you cannot or should not create an outlet with it. In that occasions, this is what you need:

let vc : AnyObject! = self.storyboard?.instantiateViewControllerWithIdentifier("myTargetViewController")

self.showViewController(vc as UIViewController, sender: vc)

But in order to make this thing work; Open your storyboard, display Identity Inspector at right pan of your Xcode and copy “myTargetViewController” to that view controller’s Storyboard ID. That should do the trick😉

Yorum bırakın

Filed under Swift

How to Write to NTFS Drives in OS X

First of all, chmod is not the answer.

  1. sudo nano /etc/fstab
  2. Write “LABEL=drivename none ntfs rw,auto,nobrowse” in fstab
  3. kntrl-O & kntrl-X shotcuts will write and save your changes
  4. Unmount your drive from Mac
  5. Unplug your drive from Mac
  6. Plug your drive back in
  7. Within Finder’s menu bar, click “Go to Folder”
  8. Type /Volumes in “Go to Folder” screen. This will display all drives whether they’re available or not
  9. Drag your drive into Favourites, left of current Finder screen.

This is how you do it.

Yorum bırakın

Filed under Mac OS X

Cannot start PyCharm No JDK found

If have an error message like “ERROR: Cannot start PyCharm No JDK found. Please validate either PYCHARM_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.” while trying to install pycharm on ubuntu, this how you fix it:

 sudo apt-get purge openjdk*
 sudo add-apt-repository ppa:webupd8team/java
 sudo apt-get update
 sudo apt-get install oracle-java7-installer

Yorum bırakın

Filed under Python, Ubuntu

How to Run Bash Scripts within Python?

There are 2 different approaches:

import os
os.system('echo "hello"')

import subprocess"./", shell=True)

Some say first approach is deprecated but i think they haven’t faced any problem when all you need is a single line command to run within different parameters. So, in my opinion each one has it’s own advantage.

1 Yorum

Filed under Python