Re: How to install Django on Windows - pip, command prompt.

2014-07-05 Thread Setiaman Lee
You can get and install python from activestate.com where pip is included.
So you can run pip from command prompt.

Rgrds
Setiaman
On 6 Jul 2014 11:44, "Sen"  wrote:

> I was going through
> https://docs.djangoproject.com/en/1.6/howto/windows/#how-to-install-django-on-windows
> I could follow until "In the command prompt, execute the following
> command: pip install django. This will download and install Django."
> I'm not sure which command prompt and "pip install django" doesn't work on
> either powershell or python shell.
> "pip" is not a proper comlet and "install" is not a proper syntax in
> python shell.
> I'm not sure what I'm missing. Is there any other way to install django?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/72edd907-1b13-428c-aa8e-8f3853d0534b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADPvYxhwAi55Jxtkbq55G9hqmhmDumJqt6EN_nNjn0sRY2FOPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: performance of delete

2013-04-24 Thread Setiaman Lee
Larry,


Avoid to use IN clause. I'd say to insert the events you want to delete
into the temp table. You can put the session id or user id in temp table to
differentiate set of data from other users. Then do the delete by joining
the temp table to the Event_Message_ldx table. your sql might look like
this:

delete event_message_ldx
from temp
where event_message_ldx.event_id = temp.event_id
and temp.userid = %s

above SQL can be executed in Django using RAW SQL. See the link below.
https://docs.djangoproject.com/en/dev/topics/db/sql/

Test the SQL in the MySQL workspace when it works then move the code to the
Django.

Rgrds,
Setiaman Lee





On Thu, Apr 25, 2013 at 8:12 AM, Larry Martell <larry.mart...@gmail.com>wrote:

> I have a table that has 2.5 million rows and 9 columns that are all
> int except for 2 varchar(255) - i.e. not that big of a table. I am
> executing this statement:
>
> Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()
>
> Where event_ids has around 1,500 items in it. There is an index on
> event_id. This statement is taking 1 hour and 5 minutes to run. There
> is nothing else hitting the database at that time, and the machine
> it's running on is 97% idle and has plenty of free memory. This seems
> extremely excessive to me. I would guess it's because of the in
> clause. Perhaps this is more of a MySQL question when a django one,
> but is there some better way to do a delete like this in django?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Hierarchy Model

2012-07-15 Thread Setiaman Lee
Hi All,

It works by blocking it with the single quote. :)
Thanks for the help.

Cheers,
Setiaman
On Jul 16, 2012 2:44 AM, "yarko"  wrote:

>
>
> On Sunday, July 15, 2012 9:02:39 AM UTC-5, Setiaman wrote:
>>
>> Hi,
>>
>> I want to implement hierarchy data model which is quite common in
>> Relational Data Model.
>>
>> Let's say I have Employee model which has the relation to the boss which
>> link to the employee model itself.
>> It will look like this:
>>
>> class Employee(models.Model):
>> empname = models.CharField(max_length=**60)
>> boss = models.ForeignKey(Employee)
>>
>
> Employee is in the middle of being defined when you make this reference, so
> ... try something like:
>
> boss = models.ForeignKey('Employee')   # delayed evaluation
>
> or:
>
>boss = models.ForeignKey('self')  # I think this reads nicer
>
> See https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey
>
>> salary = models.integer()
>>
>>
>> Sample Data:
>>
>> IDempname  bosssalary
>> --**
>> 1  albertnull  1
>> 2  bert  1  5000
>> 3  Chuck  1  5000
>> 4  Donna  3  3000
>> 5  Jack3  2000
>>
>> Albert is the root with Bert and Chuck under him and Chuck has Donna and
>> Jack under him.
>>
>> I got an error when I tried to sync to the database where Django telling
>> me that the employee is not exist in the Foreign key part.
>> Is there any way to manipulate this situation?
>>
>> Cheers,
>> Setiaman
>>
>
>
> Regards,
> Yarko
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/d5YolTy8ZO8J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Hierarchy Model

2012-07-15 Thread Setiaman Lee
Hi,

I want to implement hierarchy data model which is quite common in
Relational Data Model.

Let's say I have Employee model which has the relation to the boss which
link to the employee model itself.
It will look like this:

class Employee(models.Model):
empname = models.CharField(max_length=60)
boss = models.ForeignKey(Employee)
salary = models.integer()


Sample Data:

IDempname  bosssalary
--
1  albertnull  1
2  bert  1  5000
3  Chuck  1  5000
4  Donna  3  3000
5  Jack3  2000

Albert is the root with Bert and Chuck under him and Chuck has Donna and
Jack under him.

I got an error when I tried to sync to the database where Django telling me
that the employee is not exist in the Foreign key part.
Is there any way to manipulate this situation?

Cheers,
Setiaman

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re:Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-06-30 Thread Setiaman Lee
Hi Cal,
Interesting topic. Count me in.
On Jun 30, 2012 11:10 PM, "Cal Leeming [Simplicity Media Ltd]" <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hi all,
>
> As some of you know, I did a live webcast last year (July 2011) on our LLG
> project, which explained how we overcome some of the problems associated
> with large data processing.
>
> After reviewing the video, I found that the sound quality was very
> poor, the slides weren't very well structured, and some of the information
> is now out of date (at the time it was 40mil rows, now we're dealing with
> 700+mil rows).
>
> Therefore, I'm considering doing another live webcast (except this time
> it'll be recorded+posted the next day, the stream will be available in
> 1080p, it'll be far better structured, and will only last 50 minutes).
>
> The topics I'd like to cover are:
>
> * Bulk data processing where bulk_insert() is still not viable (we went
> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst still
> using the ORM - no raw sql here!!)
> * Applying faux child/parent relationship when standard ORM is too
> expensive (allows for ORM approach without the cost)
> * Applying faux ORM read-only structure to legacy applications (allows ORM
> usage on schemas that weren't properly designed, and cannot be changed -
> for example, vendor software with no source code).
> * New Relic is beautiful, but expensive. Hear more about our plans to make
> an open source version.
> * Appropriate use cases for IAAS vs colo with SSDs.
> * Percona is amazing, some of the tips/tricks we've learned over.
>
> If you'd like to see this happen, please leave a reply in the thread - if
> enough people want this, then we'll do public vote for the scheduled date.
>
> Cheers
>
> Cal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Send message to SMS Gateway

2012-06-23 Thread Setiaman Lee
Hi Cal, Nevio and Anh

Thanks for your reply.
The reason I want to use SMPP is because I will send high volume of
SMS per month. So cost will be a factor here. The faster and reliable
protocol is using SMPP (at least this is what I know). Probably I need
to deal with Telco network or sms distributor. Some distributor
provide http protocol but they still recommend to use SMPP and I want
to use Python/Django to interact with their server.

You have give me some valuable information, especially RapidSMS.
It looks cool. I need to research it first.

Thanks guy.

Cheers,
Setiaman Lee



On Sat, Jun 23, 2012 at 11:58 AM, Le Hoang Anh <lehoanganh...@gmail.com> wrote:
> Hi,
>
> You may have a look at http://www.rapidsms.org/
> it supports various backends (kannel, smpp)
>
> -- anh
>
> On Sat, Jun 23, 2012 at 9:11 AM, Setiaman <setiaman@gmail.com> wrote:
>> Hi,
>>
>> I want to create a web app to send the message to SMS Gateway.
>> Try to google the suggested way is to use SMPP protocol.
>> But I can't find any easy package to send message thru SMPP.
>>
>> Can any body give a pointer?
>>
>>
>> Rgrds,
>> Setiaman
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Le Hoang Anh
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Filtering ForeignKey Drop Down in Admin Interface

2012-04-12 Thread Setiaman Lee
Hi,

Thanksit works like champion.

Rgrds,
Setiaman Lee

On Wed, Apr 11, 2012 at 3:00 PM, Святослав Б <ad3w.in...@gmail.com> wrote:
> Hi!
>
> Override ModelAdmin get_form() method and filter your field.
>
> class MyAdmin(admin.ModelAdmin):
>     def get_form(self, request, obj=None, **kwargs):
>     form = super(MyAdmin,self).get_form(request, obj,**kwargs)
>     form.base_fields['field'].queryset =
> form.base_fields['field'].queryset.filter(user=request.user)
>     return form
>
> 2012/4/11 Setiaman Lee <setiaman@gmail.com>
>>
>> Hi,
>>
>> I managed to set in the QuerySet of ModelAdmin  to only allow user to
>> see their own record.
>> But when the child model link to parent model using ForeignKey a Drop
>> Down will be automatically created for the respective column.
>> Is there anyway to filter the drop down to only show the records that
>> has been created by the login user?
>>
>>
>> Rgrds,
>> Setiaman Lee.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Filtering ForeignKey Drop Down in Admin Interface

2012-04-11 Thread Setiaman Lee
Hi,

I managed to set in the QuerySet of ModelAdmin  to only allow user to
see their own record.
But when the child model link to parent model using ForeignKey a Drop
Down will be automatically created for the respective column.
Is there anyway to filter the drop down to only show the records that
has been created by the login user?


Rgrds,
Setiaman Lee.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.