This is straight from the book... the IDE is eclipse...

Hey everybody! I recently bought a book on developing for android. I got stuck on the main.xml file code when it gave me a bunch of errors... here's the code

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <SlidingDrawer    
            android:id="@+id/drawer"   
            android:layout_width="320dip"        
            android:layout_height="440dip"       
            android:orientation="vertical"         
            android:handle="@+id/handle"        
            android:content="@+id/content">

            <ImageView    
                android:id="@+id/handle"                            
                android:layout_width="48dip"         
                android:layout_height="48dip"              
                android:src="@drawable/icon"  />

            <AnalogClock 
                android:id="@+id/content"     
                android:background="#D0A0A0"                                    
                android:layout_width="fill_parent"           
                android:layout_height="fill_parent" />     
        </SlidingDrawer>              
    </RelativeLayout>

I get several errors...

  1. Element Type "SlidingDrawer" must be followed by either atribute specifications ">" , or , "/>"

  2. Error parsing XML: not well formed (invalid token)

  3. SlidingDrawer layout or its parent RelativeLayout may be useless

If any of you could point me in the right direction I would appreciate it :D

Hey guys, I was wondering if someone could help me interpret line by line what is happening in this code...

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello, Android");
       setContentView(tv);
   }
}

I got accepted for the AC2DM, but I'm not sure how to send messages to the application....
Help?

Hey everybody, I just made an application for Android, and In the developer console it reads as published, but when I search the application, it does not find it... any help on this?

Hey guys, I'm looking for a python library that can.

  1. Act as a simple paint editor.
  2. calculate top, bottom, left, right most points of a picture

I'm trying to make a simple handwriting recognition software based on the number of permutations possible
for simple endpoints.

Example: psudocode for one paramater.

[CODE]
If Distance From top to bottom / Distance from Left to Right == Statistically significant:
paramater = paramater + 1
else:
Increase approximation number
if approximation number >= 100
Exit

[/CODE]

Actually, I just figured it out ;) thanks

I'm sorry, but I still did not understand how python specifically interprets this code:

[CODE]
Numbers = [1,2,3,4,5,6,7,8,9,10]
print Numbers[8:3:-1]
[/CODE]

If the code was like this:

[CODE]
Numbers = [1,2,3,4,5,6,7,8,9,10]
print Numbers[1:11:2]
[/CODE]

I would want an answer like this:

"Python sees that in the Start position you have 1, which tells it to start at index one, inclusive.
Python sees that the Stop index is 11 , exclusive.
Python sees that you want it to count every second element from index one.
The output will then be [2, 4, 6, 8, 10]

Can someone tell me, step by step, how python interprets this code?

[CODE]
Numbers = [1,2,3,4,5,6,7,8,9,10]
Numbers[8:3:-1]
[/CODE]

I know that the "-1" is the counting bit of it, and it goes in the negative direction, but I'm lost on everything else... :(

I'm typing the code:

Python Syntax (Toggle Plain Text)
import cmath
import math
print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) , pow(2,3,1)

and I'm getting this error:

File "sample2.py", line 26
print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) , pow(2,3,1)
^
SyntaxError: invalid syntax

I put the comma between the values pow(2,3) , pow(2,3,1). and it said the same thing

I'm typing the code:

[CODE]
import cmath
import math
print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) pow(2,3,1)
[/CODE]

and I'm getting this error:

File "sample2.py", line 26
print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) pow(2,3,1)
^
SyntaxError: invalid syntax

Why is this invalid syntax?

Bless you sir.

I've been googleing the syntax, function, and examples for these keywords, but to no avail:

  1. as
  2. with
  3. assert
  4. pass
  5. yield
  6. break
  7. except
  8. class
  9. exec
  10. in
  11. raise
  12. continue
  13. finally
  14. is
  15. for
  16. lambda
  17. try

Help please? Most of the documentation is esoteric and with no example. I am a very newb programmer, perhaps there is some reference site I am missing? I know python has extensive documentation, but most of it makes no sense.

"del" allows you to delete elements from a list for example...

[CODE]

Makes list, note in python when addressing an element, the first element is 0, the second is 1.

a = [1,2,3,4]

[0,1,2,3] shows how python "reads" the location.
Prints elements in list a

print a

deletes the "first" element which is element 0

del a[0]

prints the elements in list a, minus the original 1 value in the 0 place.

print a

[/CODE]

Lots more specifics at
[url]http://learnpythonthehardway.org/book/ex34.html[/url]

Yes, thank you :)

Indeed, he was a great man. RIP Christopher.

I'm sorry, I do not understand this "The issue I still have is that you are skipping over how things are put into sys.argv When I invoke a python script from the command line: python myscript.py some subsequent words the python interpreter puts the script name into sys.argv[0] and any subsequent arguments into the rest of the sys.argv list. So from the command line above, you would end up with sys.argv == ['myscript.py', 'some', 'subsequent', 'words'] If you don't put exactly three arguments on the console command line when invoking your script, you will get a failure. Your comment almost seems to imply that the program interacts with the user to get the values. Not true."

Can you explain it in a high level way that anybody could understand (analogy) ? I'm sorry I'm so thick.

Ok, so if I were to comment the code, then would this be good comprehensive commenting?

Imports specific feature of "sys" named argv

from sys import argv

Assigns a list of variables to argv to be taken from the consol.

script, first, second, third = argv

Prints "text", then the string that was entered into the consol.

print "The script is called:", script
print "Your first variable is:", first
print "your second variable is:", second
print "Your third variable is:", third

Hello all, I've been messing around with code since for a while, but never really seriously did anything with it. I started out with BASIC on the 3.1, and now I'm trying to learn python. I'm thinking about getting a regular job at programming if I go back to school, or if im good enough, I wont have to :p.

I like making robots, laser scanners, any DIY electronics / mechanics project, and I love it :D

Hey guys and gals, I'm just starting Python, and I was wondering if someone could translate this code into english ?

from sys import argv

script, first, second, third = argv

print "The script is called:", script
print "Your first variable is:", first
print "your second variable is:", second
print "Your third variable is:", third

I got this code from the "Learn code the Hard Way" series, but I do not understand exactly what is going on...
Thanks in advance :D