RE: ewby on programming need some tips and tricks

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 6 Dec 2008 22:21:49 -0500


I am going to  break in on this discussion of Python for the blind.  I am
betting a lot of you have not used the Icon, or the Braille plus PDA's.  I
have a feeling this may change in the future but I can't say more than that.
I can say though I am one of the new coders at APH on the Braille plus and
Icon.  Now this fits both discussions that are going on on this list because
the OS that the device runs on is OE Linux, with Eloquence as the speech,
and the programming language we are currently using to make the GUI's is
Python 2.4.  I don't know if they want it known how many people are working
on this project but its less than 10 and around 75 % are blind or very low
vision.  So that means we are coding in c and c++ for the drivers and the OE
Linux and python to make all the stuff like file browser, Word Processor,
daisy book reader, bookshare downloader that is really cool, Radio tuner,
Calendar (the most accessible calendar I have ever seen), music player, and
so much more.  Not only do we have it so we have a GUI in python but anyone
can add applications to the device by writing their own thanks to python.

Now with all that said let me return to the question of is python accessible
to the blind.  Most of you that really know me on this list know that I
breath and eat c and c++ I can write it in my sleep and compile it in my
brain.  I rarely look things up and if I have more than 2 errors in a 300
line function that I write from scratch I am mad.  Before I took the job at
APH I had coded about 3 things in python and they were all small tools.  I
hated it.  I didn't like how you had to space things and I missed not having
semi colons be the line enders.  I hated how some things were functions and
some things were built in (fixed in python 3.0) but we are talking about
python 2.4.  I have been working for APH now since September 15th.  And my
dislike for python has almost vanished.

Lining up code is no work at all when you have editors like ed sharp, or
boxer or other editors that keep your indent at the same level and are able
to show you the indents when you want.  I can easily find my indent level
with boxer and I have already been known to write functions over 100 lines
of code with no errors.  The coolest part about python though is you can
find out what are in classes without documentation you just run up the
python interpreter and do 

Dir (time)

It will show you all the things you can do with time not only that but it
will show you all the classes variables and if it has a document function.
You can use that in code to so what you do with the command line you can do
with code.  How many times have you aid dang I wish I knew what arguments
this function takes.  In .net you would arrow through the intelesense and it
would give you the arguments but unless Jaws is happy that doesn't always
read right but in python you can use the inspect module to find out not only
how many arguments but what their types are if they have default values and
what those default values are.  So if you get some library that you have no
idea what it does it takes you about 5 minutes of commands and your now able
to use it.   That is amazing to me.   Even Java docs is harder than that.


Python has it all it has classes functions generic coding like I have never
seen other than maybe in Java but even Java makes you jump through more
bells and whistles to get some of the things done.  You can stick ints in
classes classes in ints because Python don't care what you stick where it
will try to do what you want and if it can't it will be pretty clear about
why it won't.

In this short time I have been with APH I have 4 working applications under
my belt and more on the way.  I can't tell you what they all are but its
pretty impressive what you can do in a short time by combining what python
has by default.  Even better though if you're a c or c++ coder like me and
python does something too slow for your liking no problem.  You just code
yourself a plug in and give python access to it and wamo you have a new
python module  that everyone on the device can use.  

I have not reached the speed in coding that I have in c and c++ but I am
pretty fast at it and I no longer make the indention mistakes I had before.
One secret is to set your tab to 4 and make sure it uses spaces.  I had it
set at 2 to start but I found that 2 spaces per tab made it hard to find
spacing problems but 4 was much easier I don't know why but it does make a
difference.  The other secret is to have a editor that can read how many
spaces somehow.  I would suggest Jamals ed sharp if you want to have it easy
but I wouldn't suggest the converter he has yet it's still kind of buggy.  I
like boxer because I have used it since MsDos 5.0 and I just know how it
works.  If I didn't have boxer I would be using ed sharp.    Another secret
is to break things up into separate files.  The nice thing is you can run
each file through the interpreter and it will spit out errors even if your
not running it so if you have a function that is called from one file to
another you can check that function just buy running it through the
interpreter it don't care that you don't have a main like c or c++ or Java.
It's more like Pearl that way.  It doesn't care that you don't run the
function it just checks its syntax and returns.  You might think the more
files it would be slower and that's not the case.  In fact it speeds it up
because Python is smart it pre compiles to an object but it don't load
things totally unless it needs it.  Another thing I have recently learned is
don't try to use a lot of try except blocks to catch errors when you start
out.  The reason is if you have something in a try except block you might
have a hard time finding it because python will happily go on without
telling you there was a problem if you don't do something with the error and
something you see in a lot of books is

Try:
   Code to do something
Except:
 Pass

Which means if that something errors just go on.  This sounds great but the
problem is it doesn't give you a log error or anything so you might cover up
errors you need to know about if you are being lazy and that causes some
real problems take it from me I spent 2 days finding a one line error
because I covered it in two try except pass statements.  Let python error
and fix the errors rather than catch them if you have to use try make sure
you know what you're doing it can be nice if used right.

Anyway so the shorter answer to the question is hell yes the python
environment is accessible.  One of the better free screen readers is written
in python and while I was worried at first about working on a device using
python I am pretty amazed at how it works now.

To go back to the Linux question and if you got this far I am amazed but
anyway I also like Linux the other day we got a device in and the 40 gb
drive was having problems.  One of the blind techs took it and using the
speak up commands on the console of it ( yes the Braille plus uses speakup
at the console) re-partitioned the drive  by unmounting it while using our
flash drive and re formatted it and got its bad clusters fixed.  Try that on
a  windows CE or even a desktop machine.  Not to mention we had a problem
with Braille input devices I won't say what but we made a slight change to
the Kernel code and fixed it try that on a windows machine when the problem
is in the kernel.  If you're not a geek then maybe it's better you stick
with Windows you can always pay someone 30 bucks to 79$ an hour to fix your
hard drive crashes but I personally want to be able to fix my own problems
and that means not having to totally reinstall my computer I want to be able
to work on it and the only Operating system right now that we can do that on
is Linux unless you count the Mac at the command line.  The problem with the
Mac is when you have a problem with a  mac and that pretty question mark
comes up (like the windows screen of death)  There is only one fix and that
is reinstall.  Linux is more robust than that and the only death cries I
have heard from Linux have been hard ware based.  Even back in October 2003
when a hacker got my network Linux box my ISP told me and we fixed it.  I
didn't have to go in and reinstall all the OS because even though we had
been hacked Linux kept them where we could contain them.  This was without a
firewall and virus checker installed it just has more division of user space
and root access something Windows is only starting to learn and people are
really bitching about that. 

Anyway I will get off my soap box but no one will ever convince me that
Windows is more accessible. Its more easy to use but it's not more
accessible.  As for python if you code in any language and I mean any and
you learn its little quirks you can code in it 

Ken

    
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Octavian Rasnita
Sent: Saturday, December 06, 2008 4:25 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: ewby on programming need some tips and tricks

Well, I would also like to know what Jamal thinks about the friendlyness of 
Python for the blind.

Octavian

----- Original Message ----- 
From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, December 06, 2008 9:01 PM
Subject: Re: ewby on programming need some tips and tricks


> um... since when is it not "blind friendly?" Tell jamal that, and nick 
> here too. Unless they've got a switch in the back of their head. If you go

> take classes somewhere to get certified, you can't just say "it's not 
> blind friendly, so just pass me."
>
>
> Thanks,
> Tyler Littlefield
> email: tyler@xxxxxxxxxxxxx
> web: tysdomain-com
> Visit for quality software and web design.
> skype: st8amnd2005
>
> ----- Original Message ----- 
> From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Saturday, December 06, 2008 11:52 AM
> Subject: Re: ewby on programming need some tips and tricks
>
>
>>I didn't say that the applications made with python are not accessible.
>> Python might use more libraries for creating the GUI, and if those 
>> libraries can create an accessible GUI (like WxPython for example), then 
>> those programs created with python will be as accessible as those created

>> with wxWidgets with any other programming language.
>>
>> What I said was that the programming language is not friendly for the 
>> blind, because it forces us to indent the code very strictly, while most 
>> other programming languages don't do this.
>> Using indentation is recommended by the sighted programmers because an 
>> indented code is much easy to understand visually, but a blind programmer

>> can't see the entire screen and understand the flow of the program, so 
>> the indentation is pretty useless.
>>
>> So we might miss a single space and the program won't compile just 
>> because of that.
>>
>> But just like other languages like VB or ruby, python doesn't use braces 
>> for defining blocks, and without beeing able to see the screen entirely, 
>> it is hard to jump from the beginning of a block to the end of the block,

>> or to select that block of code, and it is also harder to know if the 
>> current line is a new line or if it is just the previous line which is 
>> very very long.
>>
>> With other words, I also don't like python because it forces us to do 
>> many things in a single way only, but no doubt, if it would have a syntax

>> like Java, perl or C#, I would have liked them much more.
>>
>> Octavian
>>
>> ----- Original Message ----- 
>> From: "Nick Stockton" <nstockton@xxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Saturday, December 06, 2008 8:15 PM
>> Subject: Re: ewby on programming need some tips and tricks
>>
>>
>>> Hmmm why do you say python is "one of the least friendly programming 
>>> languages for the blind"?  I started learning python a month or so ago 
>>> and in around a week I had written a program complete with a GUI and 
>>> install wizard that looks up barcodes on bcscan.com and will 
>>> automatically speak the output using the jfw and wineyes com objects as 
>>> well as putting the output in a read-only edit box and automatically 
>>> setting focus to it so the output can be reviewed with the up and down 
>>> arrows.  I also made a button to pull up the edit page on bcscan.com for

>>> the item you scanned in your default web browser so you can add or edit 
>>> the item info.  I also made hotkeys ALT-b to set focus to the barcode 
>>> entry edit box, ALT-o to set focus to the output and alt-e to activate 
>>> the add/edit button.  All this from me, a python newbie who doesn't know

>>> any other programming language in just over a week!
>>> And what you might ask is my secret?  Three things: The python tutorial 
>>> at python.org, the speakup screen reader under gnu/linux and my most 
>>> secret weapon of all... google.
>>>
>>> Nick Stockton
>>> ----- Original Message ----- 
>>> From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
>>> To: <programmingblind@xxxxxxxxxxxxx>
>>> Sent: Saturday, December 06, 2008 2:58 AM
>>> Subject: Re: ewby on programming need some tips and tricks
>>>
>>>
>>>> No I don't recommend perl if is needed to create that kind of program.
>>>>
>>>> Perl is the best for web apps which are not very simple, and it is also

>>>> good for desktop apps that require some specific things that can be 
>>>> done using some CPAN modules, because that way the coder won't need to 
>>>> do very low-level programming as  he might need to do with languages 
>>>> like Java or python.
>>>>
>>>> If the program is just one that should be used by a single person, and 
>>>> if it doesn't need to be portable, and if it doesn't require very 
>>>> complicated things, I would also recommend C#. I don't like VB.net 
>>>> though. :-)
>>>>
>>>> Anyway, from the perspective of accessibility and responsiveness, the 
>>>> best choice is no doubt C++ with MFC, but it is much harder to create a

>>>> program with C++/MFC than with DotNet, so DotNet is now prefered.
>>>>
>>>> Of course, Java with SWT could be also a solution, but unfortunately 
>>>> there is no accessible forms designer for the blind for creating 
>>>> programs with SWT like with DotNet.
>>>>
>>>> And python is one of the least friendly programming language for the 
>>>> blind so of course I can't recommend it.
>>>>
>>>> Octavian
>>>>
>>>> ----- Original Message ----- 
>>>> From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
>>>> To: <programmingblind@xxxxxxxxxxxxx>
>>>> Sent: Saturday, December 06, 2008 4:17 AM
>>>> Subject: Re: ewby on programming need some tips and tricks
>>>>
>>>>
>>>>>I would recommend c# or vb.net.
>>>>> Teddy will no doubt recommend perl, but I think vb.net or c# would be 
>>>>> the best for you
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Tyler Littlefield
>>>>> email: tyler@xxxxxxxxxxxxx
>>>>> web: tysdomain-com
>>>>> Visit for quality software and web design.
>>>>> skype: st8amnd2005
>>>>>
>>>>> ----- Original Message ----- 
>>>>> From: "Jose Lomeli" <jose.lomeli93@xxxxxxxxxxx>
>>>>> To: <programmingblind@xxxxxxxxxxxxx>
>>>>> Sent: Thursday, December 04, 2008 11:18 PM
>>>>> Subject: e: ewby on programming need some tips and tricks
>>>>>
>>>>>
>>>>>>I am thinking of using python or vb6 or any other ones.  I want to 
>>>>>>create a checkings and savings program.  Please write back.
>>>>>> From Jose Lomeli.
>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>>From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx
>>>>>>>To: <programmingblind@xxxxxxxxxxxxx
>>>>>>>Date sent: Fri, 5 Dec 2008 19:04:17 -0700
>>>>>>>Subject: Re: ewby on programming need some tips and tricks
>>>>>>
>>>>>>>hello,
>>>>>>>first we need to decide what language your going to use.  any
>>>>>> ideas?
>>>>>>>What kind of programs do you want to write?
>>>>>>
>>>>>>
>>>>>>>Thanks,
>>>>>>>Tyler Littlefield
>>>>>>>email: tyler@xxxxxxxxxxxxx
>>>>>>>web: tysdomain-com
>>>>>>>Visit for quality software and web design.
>>>>>>>skype: st8amnd2005
>>>>>>
>>>>>>>----- Original Message -----
>>>>>>>From: "Jose Lomeli" <jose.lomeli93@xxxxxxxxxxx
>>>>>>>To: <programmingblind@xxxxxxxxxxxxx
>>>>>>>Sent: Thursday, December 04, 2008 10:57 PM
>>>>>>>Subject: ewby on programming need some tips and tricks
>>>>>>
>>>>>>
>>>>>>>> Hello; Listers, I am new to programming and I want to start
>>>>>> doing
>>>>>>>> this.  What are some tips and tricks I should know about and
>>>>>> what
>>>>>>>> program do I use for this and where can I download it? Please
>>>>>>>> write back.
>>>>>>>> From Jose Lomeli.
>>>>>>>> __________
>>>>>>>> View the list's information and change your settings at
>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>
>>>>>>>__________
>>>>>>>View the list's information and change your settings at
>>>>>>>//www.freelists.org/list/programmingblind
>>>>>>
>>>>>> __________
>>>>>> View the list's information and change your settings at 
>>>>>> //www.freelists.org/list/programmingblind
>>>>>>
>>>>>
>>>>> __________
>>>>> View the list's information and change your settings at 
>>>>> //www.freelists.org/list/programmingblind
>>>>>
>>>>
>>>> __________
>>>> View the list's information and change your settings at 
>>>> //www.freelists.org/list/programmingblind
>>>>
>>>>
>>>> __________ Information from ESET Smart Security, version of virus 
>>>> signature database 3668 (20081206) __________
>>>>
>>>> The message was checked by ESET Smart Security.
>>>>
>>>> http://www.eset.com
>>>>
>>>>
>>>>
>>>
>>> __________
>>> View the list's information and change your settings at 
>>> //www.freelists.org/list/programmingblind
>>>
>>>
>>
>> __________
>> View the list's information and change your settings at 
>> //www.freelists.org/list/programmingblind
>>
>
> __________
> View the list's information and change your settings at 
> //www.freelists.org/list/programmingblind
>
> 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: