Feeds:
Posts
Comments

where we have to use ‘through’ in django many-to-many model field?

In django the many-to-many field used to have multiple relationships with referred and used models

In generally, if you use many-to-many field django automatically creates a intermediate table

suppose, for your mighty usecase, you want to add some additional fields in that intermediate table

you can go proceed with the ‘through‘ feature

Image

refer-doc link https://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany

In the above attached image, the Membership class contains the additional fields like date_joined,invite_reason available as I explained above

Without using this special feature, if you do the adding extra fields(date_joined,invite_reason) in the Group class itself,

you can have the field for the each group object like

group([person1,person2,person3,etc..],date_joined,invite_reason)

but not like this

group([person1,date_joined,invite_reason],[person2,date_joined,invite_reason],

[person3,date_joined,invite_reason]…

etc…)

To obtain this usecase we have to go with ‘through‘ attribute feature as availble in the diagram

Got the seminar from @shanmuganandhg

1. What is the size of data?
2. What is your ram size?
3. Will the data fit into your ram?
4. So, If you need to run the analysis for the streaming data,everytime will you do the computation for the whole amount of data(sequential logic) or else
storing the computed state into memory(combinational logic) and processing from it for the streaming data?

After took the decision from the fourth question

5.Think about How to be implemented For example, In python(consider main memory,low data size) or postgres(table,large data size)

Hint:

If you want to do sequential logic you can also think about colocation of the data(grouping the data).This will make the job simpler.

It was an urgent to me for recharging the amount in mobile.when I was doing with hurry,the app frustrates me

I filled all blank fields and it asked me for the confirmation also.

 

When i clicked the confirm button it throws me

NULLPOINTER EXCEPTION

I think they have done in struts

It frustrates the customer isn’t?

better they can move to Django to avoid these kind of frustrating problem to make unfriendly with customer.

:-)

 

Great Answer in Quora

Technologies don’t matter. 

Programmers like to talk about technology. Is Ruby better than Python? Which RPC layer is faster? Should Facebook use Python and not PHP? This is great, and you should know and have opinions about those facts (especially if you’ve followed the latter advice). But quite surprisingly, if you look at successful and unsuccessful engineering efforts, there is essentially no correlation between success and the exact types of technologies that are used. What matters is who is working on a team, how they use the technologies, and how they work together. Good software engineering is done by good software engineers. It’s rarely done with the perfect programming language, or the preferred operating system, or using the most hyped new technology. A lot of the hardest challenges in software development concern the way people communicate and work together, not in raw technology.

There are many important corollaries to this: Pick programming languages you or your team use well, or are aligned with the market, or are popular enough you can hire folks. Be pragmatic, not religious about how you solve problems. Learn by working with great engineers, and seeing how they solve problems, not by preferring a particular approach. Realize that effective communication and good engineering culture are even more important than powerful tools

Source : http://www.quora.com/Computer-Programming/Expert-hackers-What-are-your-top-three-insights-for-a-novice-programmer

 

Good to follow it :-)

Python debug

Python Debugger:

Recently i came to know that The most important things to be a Great programmer,not only to know the programming..knowing the debugging is makes this as a great programmer from quora and swaroop

So,Certainly I was searching about debugging in python.

>>>import pdb

python debugger package to debug your python gold code.

>>>pdb.set_trace()

This line you need to add where you want to start debugging.

Absolutely we can debug

>>>pdb.run(“string function object”)//function object as a string

There are pretty lot of options and commands are there to do debugging.

The debugging shell looks like

> /work/t/rec.py(12)recursive_fn()
-> return
(Pdb) args
n = 3
output = to print
(Pdb)

The command options in the debugging shell:

list

list the lines where the current call stack is processing

step

Next line to be debugged

next,until,up,down…

These are the commands which does the operation according to it’s meaning.

p var

print var(var means variable)

p var1,var2,var2

pp var

pprint variables by comma seperator

where

current call stack

If you want assign a value for a variable in the debugging shell

You have to use the (!) exclamatory mark

!var = value

These won’t throw exception related to object

These are the basic skills i touched today

If you need elaborately go ahead with these

http://www.doughellmann.com/PyMOTW/pdb/

Welcome you!

I have been facing the problem whenever I setup new amazon ec2 instance for the project.

I need to setup the instance with all packages.

I was searching repeatedly.It is better to take a snapshot of the packages

Ofcourse I have python in my instance.

PIP:

I need pip installer for python packages:
sudo apt-get install python-pip

Py-dev:

Python development packages to avoid “gcc exit status command” problem.This is the problem which i was facing few times whenever i need to compile some source packages. This will be solved by installing the below packages

sudo aptitude install python-dev

sudo apt-get install python-setuptools build-essential
sudo apt-get install libpq-dev

lxml:

i need it for my project.It used to parse the html,xml data
sudo apt-get build-dep libxml2
sudo apt-get install python-lxml

Django:

This is my tool to build the project.yeah..now i need this particular version
sudo pip install Django==1.3

PIL:

I am using imaging library in mymodule.I used in django admin to display like preview images for the easy identification
sudo pip install PIL

Django-Oembed:

This is the piece of package to embed the videos in your django based web app.yeah,here i used to embedd some youtube videos for my project

svn checkout http://django-oembed.googlecode.com/svn/trunk/ django-oembed

Block buster:
Postgres:

It is must be used with it’s specifications.While the previous setup i used the same version.So i am continuing this..
sudo apt-get install postgresql-8.4

This is for the installation

Hi Welcome u,

Old is Gold

Take the old beautiful soup It works fine but new soup has some problem with unicode and string.

sorry If i confused you.

Now for sometime I have been working on the parsing html data in python.For this operation we have the standard module called “BeautifulSoup“.When I was working with this suddenly i have faced the problem “HTMLParserError” after i got to go google.

It says that

“you r using the new BeautifulSoupSome modifications has been done on the new soup module that is the parsing is happening from html rather to use lxml.”

So, again I asked the version to find my soup.

again it says politely,

“navatux@localhost$python

>>>import BeautifulSoup

>>>BeautifulSoup.__version__”

>>>”"” Here you need to notice the output .ie Version

So, I did the same thing and I got the number 3.1.7

again I conducted him.

It says,

“Try to install the version 3.0.1a” will be somewhat good.

Again i need to follow that.

I did it downloaded the exact version and installed(3.0.1a) after uninstalled the old one(3.1.7).

Reference:

http://stackoverflow.com/questions/601166/issues-with-beautifulsoup-parsing?s=0c3dca2e-3f3b-4a13-8d79-c13b1204dd7d

Now it works fine. :-)

If i face any new issue let you know :-)

bye ;-)

Follow

Get every new post delivered to your Inbox.

Join 173 other followers