bitnami-godaddy

I recently created a cloud server instance on GoDaddy and installed a Bitnami application (Discourse) on it for one of my domains. Then I realized this Bitnami banner on the lower right corner. After some research and trials, I was able to remove this banner from my Discourse forum site. Here is how you can remove Bitnami banner from your website or web application on GoDaddy. Click Manage next to Cloud Servers Click Actions and Manage Server Now click Console and click Connect If you can’t see the console load, click Console and click Reconnect Once connected go to /apps/your_app_name in this case /apps/discourse Type “ls” and hit enter. You will see the bnconfig daemon listed Now type the command[…]

how kerberos works

Kerberos is a computer network authentication protocol that was developed by MIT. An open source, free implementation is available from MIT as well as commercial implementations from other vendors. Kerberos is the native authentication protocol in Active Directory. Here is how the protocol works: In Kerberos, there is no communication between the resource (server) and the KDC. Client takes on the majority of the processing burden in Kerberos, which distributes the authentication workload across the network. 1- Client attempts to log on to the network Client constructs and authenticator. This includes day and time data, so the authenticators are valid for only a certain period of time. So, they can’t be captured and re-used by an attacker. Some portion of the authenticator is[…]

django-int object has no attribute keys

Being new to Django, sometimes I face interesting problems. If it is very late and you are very tired, It may not always be easy to see the problem looking at the displayed error message like this int’ object has no attribute ‘keys’ error message I got in cursor.execute() method 🙂 This error was thrown on the line below: cursor.execute(“select col1,col2 from table_name where col3 = %s”, integer_value) The reason I got this error was that I had provided the integer directly as an argument but according to the documentation the second argument must be a sequence or mapping. Below solved the issue: cursor.execute(“select col1,col2 from table_name where col3 = %s”, [integer_value]) Hope this helps. Good Luck, Serdar

Django NoReverseMatch Error

Django’s reverse method can be found under django.core.urlresolvers (new versions: django.urls). To be able to use it you should import it like so:

reverse method is used to generate urls so that you can use them in your template files, model methods, view methods etc. Why do we use them? We use them not to hard code our urls to adhere to DRY (Don’t Repeat Yourself) principle. Why am I talking about reverse? Because reverse method is where I encountered this NoReverseMatch error. Error message was something like this: Reverse for ‘xx’ with arguments ‘()’ and keyword arguments ‘{‘xx’: ‘xx’}’ not found. 1 pattern(s) tried: [‘(?P<xx>[-\\w]+)/(?P<xx>[-\\w]+)/$’] I replaced the variable names with “xx” above. Let’s see the bits of code[…]

django related_name

related_name is an attribute you use while defining relations like many-to-one, many-to-many, one-to-one etc. The value of this attribute is used as the name of the reverse relation between models. Example:

Here we define a many-to-one relation using a Foreign Key. A Site can have many Pages. The relation from a Site to its pages can be expressed as such:

A reverse relation can be defined from the Site to Pages as you see above. It is important to understand the importance of related_name attribute. related_name can save you from many headaches by preventing clashes from ever happening in your applications. Different models having a Foreign Key relation to the same “X” model could have clashes for using[…]

No ‘jar’ binary detected in PATH. I encountered this error message when I was trying to install RedHat JBoss BMP Suite for the first time. At first, I thought I needed to install JRE and include the bin folder in the path. Apparently, that was not the solution. What you need to do is install the JDK and include the bin folder of JDK in your “Path” system variable. It would look like this:

Right Click “Computer” -> “Properties” -> “Advanced System Settings” -> “Environment Variables”. There you will find “Path” under System Variables. Append the above line into this variable. Now JBOSS BMP Suite Installation jar should work. Hope this helps. Good Luck, Serdar

In my new Django project, I was trying to append a list of tuples (which contained more than 1 tuple in it) into another list of tuples. Then I got this error: ValueError: too many values to unpack (expected 2) I was using .append() method to perform this operation and apparently that is exactly where the problem was. Result: You cannot append a list of tuples with more than one item into another list of tuples using .append(). You need to use “+=” operator to do this. Hope this helps. Good Luck, Serdar

django-no-such-table

Django “no such table” error of death.. I recently encountered this “no such table” error while trying to run makemigrations command on PyCharm. I dropped database tables related to my app, cleaned django_migrations table for this app, cleared migrations folder as described in this post: http://big.info/2016/07/django-clear-migrations-re-migrate.html. Then I ran makemigrations… No such table.. I did lots of googling but none of the solutions I found was applicable to my case. After some inspection of the error messages generated, I found out that one of the forms in my forms.py was trying to access a database that I had deleted. I commented out this form’s code and re-run makemigrations command. This time it was successful. Hope this helps. Good Luck, Serdar

difference-library-framework

Recently, I heard 2 of my friends talking about the difference between a framework and a library, and I thought some may need a clear explanation to see the difference. Check out the simple diagram below. Library A library is essentially a set of functions that you can call, these days usually organised into classes. Each call does some work and returns control to the client. The defining characteristic of a library is that you are in control, you call the library. Framework A framework embodies some abstract design, with more behaviours built in. In order to use it you need to insert your behaviour into various places in the framework either by subclassing or by plugging in your own classes. The[…]

pycharm django breakpoint

Debugging a Django project in PyCharm is actually quite easy. All you need to do is add couple of breakpoints and hit that little debug button you see at the top right corner of the IDE. Now when you run your app, PyCharm’s Django debugger should stop at those breakpoints, right? Nope, not that straightforward. Breakpoints that won’t stop the debugger Check out the lines below for example. I first put breakpoints on these 2 lines but the debugger would not hit any of them: This one stops the debugger Then I added 1 more breakpoint and voila. Debugger stops now. Suspend You see. Not all the breakpoints will make the debugger stop there. But why? Why did it not stop at my[…]