[Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Hi All,

This is my first post and I want to set a plan for learning python 
syntax within 2 weeks.


I'm C++/Qt desktop developer and I want to learn python for creating 
rapid web applications so I read some articles about that and I found 
that django is suitable framework -I guess- but I still need some info 
to complete my plan then applying it.


  1.  From where I can start python by examples for C++ developers (I
 don't want documentation tutorials cuz I need simple tutorials
 compares between C++ & python syntax just at start point)?
  2. What's most IDE like Qt Creator (smart code completing is very
 important to me)?
  3. One of most different -I guess- between PHP & ASP.net is separated
 html code, does python separates html code or not?
  4. Do I need any pre knowledge about CGI principles before stating
 developing web application with python?
  5. Does django provide rapid framework for web applications just like
 Qt? or you suggest better framework (I don't want to create web
 applications from scratch)?
  6. What's most suitable packaging tool (deploying desktop
 applications) for Windows OS?
  7. Does the period of 2 week enough for learning python syntax &
 basics of web developing?
  8. Does any one tested an experience just like me (learning a new
 language within short period could be crazy ;-) )?


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Hi denis,

On 12/05/2010 01:25 م, spir ☣ wrote:

On Wed, 12 May 2010 13:09:05 +0200
"M. Bashir Al-Noimi"  wrote:

   

Hi All,

This is my first post and I want to set a plan for learning python
syntax within 2 weeks.

I'm C++/Qt desktop developer and I want to learn python for creating
rapid web applications so I read some articles about that and I found
that django is suitable framework -I guess- but I still need some info
to complete my plan then applying it.
 

Just a few comments:
   
humm, you confused me I'm still a newbie and I don't know anything about 
differences between C++ & python even I couldn't understand you. How C++ 
is a static language !??!!


I use C++ since I was in high school and I still found it most flexible 
language, and if I found C++ is suitable for rapid web applications (you 
can read about wt C++ web toolkit) I'll never try to learn a new 
language but C++ in fact not flexible for web applications, for that I 
decided to learn python.


In addition to your confused comment you didn't answer vital my questions.

*PS*
Please notice that if I knew the differences between C++ & python or 
even knew enough info about python be sure that i'll never post any 
question here cuz there is python-l...@python.org mailing list for 
python questions not for newbie just like me :-[




   

1.  From where I can start python by examples for C++ developers (I
   don't want documentation tutorials cuz I need simple tutorials
   compares between C++&  python syntax just at start point)?
 

Depending on what you really mean with these words, it may be a wrong approach, imho. 
Learning a new language is not just a question of catching syntactic patterns, not even if 
you properly get associated semantics. It's rather a question of developping a new way of 
watching topics or problems, and thus modelling&  designing differently. Else, what you 
end up with is "charabia", like if translating form arab to chinese word-for-word 
;-)
This is especially important when passing from a static to a dynamic language. 
Dynamicity opens new doors to modelling practice fields. Or rather: when using 
a static language these doors are closed...

   

7. Does the period of 2 week enough for learning python syntax&
   basics of web developing?
 

See note above.

   

8. Does any one tested an experience just like me (learning a new
   language within short period could be crazy ;-) )?
 

Ditto. And yes, when I started with python intensively for a period, I used its OO 
framework like if it were static! It took me a rather long time to realise I had wrong 
mental schemes, barriers infact. (Actually, for a while, when watching properly written 
dynamic code, I even thought it was wrong&  ugly&  tricky stuff. instead I had 
a cube of concrete where there should be a brain.)
But dynamicity is not the only point. Even rather similar languages like eg Python& 
 Ruby&  Lua develop different programming approaches, styles and flavors.


denis


vit esse estrany ☣

spir.wikidot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
   


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Hi

On 12/05/2010 02:25 م, Dave Angel wrote:



M. Bashir Al-Noimi wrote:




humm, you confused me I'm still a newbie and I don't know anything 
about differences between C++ & python even I couldn't understand 
you. How C++ is a static language !??!!


In C++, every variable is declared, and the type of that variable is 
static over its lifetime.  The only flexibility there is that a 
variable may also get a value of some derived type of its declared 
type.  In Python, variables have no fixed type at all, only the 
objects (that they're bound to) have type.  A variable can be an 
integer one time, a string the next, and an arbitrary object after that.
nice that's truly easy i think this options are mix of java+VB (gc+no 
need to decalre the variable) is it?


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Hi

On 12/05/2010 02:52 م, spir ☣ wrote:

On Wed, 12 May 2010 15:01:09 +0200
"M. Bashir Al-Noimi"  wrote:

   

humm, you confused me I'm still a newbie and I don't know anything about
differences between C++&  python even I couldn't understand you. How C++
is a static language !??!!
 

Have a look at:
http://en.wikipedia.org/wiki/Dynamic_language
http://en.wikipedia.org/wiki/Static-typing_%28programming_languages%29#Static_typing
(and the rest of the article)
   

Thanks.

What about the other questions, IDE, web framework...etc?

--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Thanks a lot Walter for valuable reply,

On 12/05/2010 03:09 م, Walter Prins wrote:


On 12 May 2010 12:09, M. Bashir Al-Noimi <mailto:mbno...@gmx.com>> wrote:


   1. From where I can start python by examples for C++ developers
  (I don't want documentation tutorials cuz I need simple
  tutorials compares between C++ & python syntax just at start
  point)?

Not sure about actual examples, but have a look here: 
http://wiki.python.org/moin/LanguageComparisons


As you say, this is only a starting point however, because Python 
really introduces new idioms (natural ways of expression) that does 
not exist in other languages.  The bigger task is learning proper 
Python idioms/ways of expressing your intent naturally in Python, 
rather than writing C++ in Python syntax.
For me this comparison is enough it's just a magic drug for courage :-P 
:-P :-P



   1. What's most IDE like Qt Creator (smart code completing is
  very important to me)?
   2. One of most different -I guess- between PHP & ASP.net is
  separated html code, does python separates html code or not?

There are multiple ways to do web development in Python, including (as 
you put it) PHP style and ASP.Net style.  There isn't however really a 
RAD/visual environment specifically for *web* development in Python, 
however personally I would suggest this is not neccesarily a negative 
and may indeed be a positive.


   1. Do I need any pre knowledge about CGI principles before
  stating developing web application with python?

That depends, but I'd hazard to say understanding web (including CGI) 
principles would be neccesary.


   1. Does django provide rapid framework for web applications
  just like Qt? or you suggest better framework (I don't want
  to create web applications from scratch)?

QT is a mostly a UI widget library/framework, DJango is patently not 
really a UI widget library, although it takes care of a lot other 
details that service in the context of web development.


At the risk of confusing matters further, you may want to look into 
the "Pyjamas" project.


Pyjamas is essentially a Python to Javascript compiler with a UI 
widget abstraction layer and a Web UI layer of its,  and that has 
bindings to GTK (similar to QT) or its own web-based UI controls.  As 
a result, applictions targetting/using Pyjamas are/can be written in 
pure python, much like any conventional GUI desktop applicatoin would 
be, but which can then either run either as a web application or a GUI 
application depending on which binding is selected.


More on the Pyjamas project here: http://pyjs.org/
Nice I read about same thing in Qt labs 
http://labs.trolltech.com/blogs/2009/09/18/qt-in-the-cloud-with-qwebclient/ 
but I still have a tiny two questions, pyjamas comes with UI widgets 
which can bind to web/js or desktop/GTK, Qt or wxWidget ui, *could I use 
any ui desinger (like Glade) for designing pyjamas ui?*


pyjamas from code side like desktop ui where DJango is a full web 
framework so I'm wondering, *do I need to use one of them or both 
together (in case if i want to gain the benefits of ajax options)? *


  1.


   2. What's most suitable packaging tool (deploying desktop
  applications) for Windows OS?

There are several, each with pro's and con's.  See for example here:
http://pypi.python.org/pypi/bbfreeze/0.95.4
http://www.py2exe.org/

Which one is most suitable will depend on the context you're operating in.

   1. Does the period of 2 week enough for learning python syntax
  & basics of web developing?

You can probably get going in 2 weeks, but of course you'll not have 
mastered anything in that period and you'll be learning well beyond 
the initial 2 weeks (as you would be with any new language/platform.)


Walter




--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Thanks Alan,

On 12/05/2010 06:56 م, Alan Gauld wrote:


"M. Bashir Al-Noimi"  wrote
This is my first post and I want to set a plan for learning python 
syntax within 2 weeks.


Learning python syntax in 2 weeks is easily achievable if you go 
through the official tutorial at python.org. It is designed for people 
coming from another language, especially C++ or Java. If you work 
through it at a sensible pace - ie slow enough to think about it - you 
should be done
in 2 or 3 days. 
Oh my god, I finished the basics of python within one day (continues 10 
hours)!!!

What's amazing language :-*

From there you will know enough to start working through the Django 
tutorial material and write short simple Python function and programs.



  1.  From where I can start python by examples for C++ developers (I
 don't want documentation tutorials cuz I need simple tutorials
 compares between C++ & python syntax just at start point)?


As others have said, trying to convert your knowledge of C++ into 
Python is likely to result in you writing Python that looks like C++. 
It is also likely to introduce bad habits based on C++ limitations.

You need to learn the Python way of doing things (and its limitations!)
Actually I found some principles like extended C++ libraries, for 
example I'm using Qt classes for creating objects just like dictionary 
in python, where python provides them by default wow =-O .





  2. What's most IDE like Qt Creator (smart code completing is very
 important to me)?


Most Python IDEs do at least basic tooltips and such but if you are 
familiar with Eclipse then you can install PyDev and get all the usual 
Eclipse tools, including a good debugger. The one thing that is less 
useful in Eclipse is its interpreter prompt, but you can just use a 
tool like IDLE or Pythonwin or IPython in a terminal for that.
PyDev is amazing specially I'm familiar with eclipse (I was using it 
before releasing Qt Creator) but as I can see it's suitable for web 
applications (specially with Aptana) more than desktop application 
because web application don't need visual editor but in case if I want 
to develope dektop applications (of course in the future) what's most 
suitable IDE for that?


Until now I tested the following:

  1. PyDev <http://www.pydev.org/index.html> (95/100): amazing and gave
 a good impression for first look but it's not supporting visual
 editor for desktop applications.
  2. eric <http://eric-ide.python-projects.org/index.html>(80/100): the
 most active IDE for desktop applications in python but it has many
 negatives like autocompleting is so stupid managing the projects
 syncing changes between UI files and the code bad interface.
  3. boa-constructor
 <http://prdownloads.sourceforge.net/boa-constructor/> (70/100):
 generally it has only two negatives it uses wxPython and it's not
 active since 2007 although I prefer it more than eric but I really
 hate wx
  4. SPE
 <https://sourceforge.net/project/showfiles.php?group_id=145384>(50/100):
 most likely to eric by it has arranged interface, uses wxPython
 and it's not active since 2006 (dead project)

I found many IDEs for desktop application but most of them very simple 
or/and dead (PythonCard... etc)


Do u've more details?




  3. One of most different -I guess- between PHP & ASP.net is separated
 html code, does python separates html code or not?


Python supports all the different styles of web development but 
Django, like most modern web tools separates code from presentation.



  4. Do I need any pre knowledge about CGI principles before stating
 developing web application with python?


Since it is all built on CGI it is always a good idea to understand 
what is really going on. But raw CGI skill is not essential to get 
started in Django.

Could you guide me to quick guide for learning CGI?




  5. Does django provide rapid framework for web applications just like
 Qt? or you suggest better framework (I don't want to create web
 applications from scratch)?


Django is a framework for rapid Web development but it is very 
different to, for example Glade. It is not an IDE or visual editor.



  6. What's most suitable packaging tool (deploying desktop
 applications) for Windows OS?


If its a web server based app then installing Python and Django on the 
server and loading your packages on is a better bet that trying to 
create an exe file os similar.



  7. Does the period of 2 week enough for learning python syntax &
 basics of web developing?


Yes, but it will be a steep curve.
Ask lots of questions, and read lots of documentation.
Ask the questions in the place most likely to answer them correctly! 
(ie python stuff here, Django stuff on a Django list)



  8. Does any one tested an experience just like me (learni

Re: [Tutor] First steps for C++/Qt developers

2010-05-12 Thread M. Bashir Al-Noimi

Hi Walter,

On 13/05/2010 12:45 ص, ALAN GAULD wrote:

Forwarded to the list.
Please use Reply All when posting.
*From:* Walter Prins 
*To:* Alan Gauld 
*Sent:* Wednesday, 12 May, 2010 18:36:31
*Subject:* Re: [Tutor] First steps for C++/Qt developers

Regarding IDE's: I find Eclipse with PyDev pretty good, and it 
recently gained support for Django specifically, so it's a good fit 
from that point of view for you.   This of course does not include a 
form designer, you can choose whatever tool you like there.  As an 
aside, there's also Delphi RAD'esque tool called "Boa constructor" 
which aims to be a RAD IDE with forms designer for Python.  Not sure 
how active the project is etc, but maybe worth a look.
As I said above Boa constructor has two negatives it uses wxPython and 
it's not active since 2007




As for Pyjamas, I don't know enough about it to answer if and how it 
may be used together with Django, although I can't see any fundamental 
reasons why that should not be possible.   But, perhaps it's an idea 
for you to just develop some feel for Python itself first, writing 
some things from scratch, and once you've got a bit of a Python 
foundation you can have a look at Pyjamas etc.


Walter


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] First steps for C++/Qt developers

2010-05-14 Thread M. Bashir Al-Noimi

Thanks Steve,

On 14/05/2010 11:22 ص, steve wrote:

Hello Bashir,

On 05/13/2010 08:48 AM, M. Bashir Al-Noimi wrote:

Thanks Alan,
[...snip...]
Oh my god, I finished the basics of python within one day (continues 10
hours)!!!
What's amazing language :-*



Yes, everyone here feels the same way :). Anyways, now that you have a 
hang of python and you already know Qt, I would recommend playing 
around with PyQT just to get a feel of the language using API that you 
already know.


http://www.riverbankcomputing.co.uk/
http://www.commandprompt.com/community/pyqt/
Actually I wrote first PyQt application yesterday by using eric IDE, 
although it has stupid autocompleting and bad GUI but I could create 
Hello World app within 5 minutes, that's it.


My adventure in python going smoothly and community of python has truly 
open minds.




If you want to directly head on to learning Web Programming though, I 
suggest you start with:

http://www.djangobook.com/en/2.0/

Although, I personally am a bit biased towards:
http://www.cherrypy.org/

...which is a lean, no-frills web application framework.
In simple words could you give me what's distinguished differences 
between cherrypy and django (I didn't stat with django cuz I'm still 
python principles)?




Like other have mentioned, you don't need to know CGI programming to 
write web applications these days, but knowing how CGI works helps 
immensely. For a high level overview of web programming using python, 
see:


http://docs.python.org/howto/webservers.html

hth,
cheers,
- steve



--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [SOLVED] First steps for C++/Qt developers

2010-05-14 Thread M. Bashir Al-Noimi

Thanks Alan,

On 15/05/2010 01:51 ص, Alan Gauld wrote:

"M. Bashir Al-Noimi"  wrote


> Although, I personally am a bit biased towards:
> http://www.cherrypy.org/
In simple words could you give me what's distinguished differences 
between cherrypy and django (I didn't stat with django cuz I'm still 
python principles)?


They work a little differently and Django gives you lots of extra 
features that CherryPy doesn't - you need extra libraries to get the 
exta features. (Things like a templating engine and onject persistent 
database access. I'm also not sure how much of an admin GUI CherryPy 
delivers out of the box) In fact you can use TurboGears which is a 
direct competitor to Django and uses CherryPy as part of its 
framework. (Or it did - I know the latest version of TG has changed a 
lot!)


One of the good and bad things about Python is that it supports many, 
many, different web tookits from the simplest CGI through to Zope and 
Plone which are enterprise class web frameworks(albeit with very 
different emphases). For most folks the middle ground includes things 
like Pylons, CherryPy and TG and Django. You can do most of what most 
people need with these and they are simpler in practice than either 
raw CGI or the heavyweight tools. So pick one and stick to it. Like 
languages or GUI toolkits, once you learn one moving to another is 
relatively painfree. Provided it does what you need and has a good 
support network don't stress over it!
After reading many posts and articles I picked up Django because it fits 
my needs till now.


Thanks once again for all.

--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Different between pass & continue

2010-05-18 Thread M. Bashir Al-Noimi

Hi All,


I couldn't understand the difference between pass and continue keywords, 
could you explain to me?



--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [SOLVED] Different between pass & continue

2010-05-18 Thread M. Bashir Al-Noimi

Thanks

On 18/05/2010 02:20 م, Steven D'Aprano wrote:

On Tue, 18 May 2010 10:34:16 pm M. Bashir Al-Noimi wrote:
   

Hi All,


I couldn't understand the difference between pass and continue
keywords, could you explain to me?
 


"pass" is a do-nothing statement. It literally does nothing.

"continue" is only allowed inside a for-loop or while-loop, and
means "jump to the start of the loop". It is related to "break".

Consider the difference between these three loops:


   

for x in (1,2,3):
 

... print(x)
... pass
... print(x, "again")
...
1
1 again
2
2 again
3
3 again
   


for x in (1,2,3):
 

... print(x)
... continue
... print(x, "again")
...
1
2
3
   


for x in (1,2,3):
 

... print(x)
... break
... print(x, "again")
...
1
   
 



   


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Append sub-key to dictionary

2010-05-25 Thread M. Bashir Al-Noimi

Hi All,

I'm trying to append a new sub-key to specific dictionary but it 
replacing the content of parent key instead of add a sub-key!



How I can fix this issue?

--snippet--

addressbook = {
   'work': {
 'Andre': {
  'phone': '22761654',
  'e-mail': '5456646',
  'address': 'Syria, Aleppo',
  'website': 'www.sdff.com'
  }
},
'Friends': {
'Ahmad': {
 'phone': '34646464',
 'picture': '/home/fiends/wael.png',
 'posts': {
   'blog': 'http://www.dsfd.com/',
   'newspaper': 'http://news.com/'
   }
 },
'Issa': {
 'e-mail': 'a...@dsfdsc.com'
 }
}
   }

addressbook['Friends'] = {
   'kassem': {
   'address':'Aleppo Street',
   'Country':'Palestine',
   'articles':{
   'blog':'http://blogger.com',
   'news':'http://news.com/'
   }
   }
   }


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] [SOLVED] Append sub-key to dictionary

2010-05-25 Thread M. Bashir Al-Noimi

Thanks Vince ;-)

On 25/05/2010 07:38 م, vince spicer wrote:
On Tue, May 25, 2010 at 12:28 PM, M. Bashir Al-Noimi <mailto:mbno...@gmx.com>> wrote:


Hi All,

I'm trying to append a new sub-key to specific dictionary but it
replacing the content of parent key instead of add a sub-key!


How I can fix this issue?

--snippet--

addressbook = {
'work': {
  'Andre': {
   'phone': '22761654',
   'e-mail': '5456646',
   'address': 'Syria, Aleppo',
   'website': 'www.sdff.com  
<http://www.sdff.com>'
   }
 },
 'Friends': {
 'Ahmad': {
  'phone': '34646464',
  'picture': '/home/fiends/wael.png',
  'posts': {
'blog': 'http://www.dsfd.com/  
<http://www.dsfd.com/>',
'newspaper': 'http://news.com/  
<http://news.com/>'
}
  },
 'Issa': {
  'e-mail': 'a...@dsfdsc.com  
<mailto:a...@dsfdsc.com>'
  }
 }
}

addressbook['Friends'] = {
'kassem': {
'address':'Aleppo Street',
'Country':'Palestine',
'articles':{
'blog':'http://blogger.com  
<http://blogger.com>',
'news':'http://news.com/  
<http://news.com/>'
}
}
}


-- 
Best Regards

Muhammad Bashir Al-Noimi
My Blog:http://mbnoimi.net
 



___
Tutor maillist  - Tutor@python.org <mailto:Tutor@python.org>
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



You may have better results with:

addressbook['Friends']['kassem"] = {
   'address':'Aleppo Street',
   'Country':'Palestine',
   'articles':{
   
'blog':'http://blogger.com',
   
'news':'http://news.com/'

   }
   }
   }


this will create a new key in the Friends dict

Vince


--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor