Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Small program ideas

Reply
Thread Tools

Small program ideas

 
 
eli m
Guest
Posts: n/a
 
      02-26-2013
On Monday, February 25, 2013 10:15:24 PM UTC-8, Dave Angel wrote:
> On 02/25/2013 10:48 PM, eli m wrote:
>
> > On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:

>
> >> Any small program ideas? I would prefer to stick to command line ones. Thanks.

>
> >

>
> > Thank you guys for the suggestions. Any more?

>
> >

>
>
>
> There are all kinds of things you could do. First, consider something
>
> that might be useful.
>
>
>
> 1) checksum all the files in a directory tree, using various checksum
>
> algorithms.
>
>
>
> 2) Convert one kind of file to another.
>
>
>
> 3) Calculate time between two dates
>
>
>
> 4) Write some part of a backup system. For example, copy files from a
>
> directory tree into a specified directory, stopping when the size totals
>
> N.N gig, and keeping track of which files have been so processed, so
>
> that after burning that directory to DVD, you can repeat the process.
>
> As a bonus, add a utility & datafile to the top of that directory, so
>
> that the DVD can be self-checking.
>
>
>
> Then try something interesting:
>
>
>
> 1) find the nth prime, for example the 1000th prime
>
>
>
> 2) Find all perfect numbers under a trillion
>
>
>
> 3) solve the puzzles on http://projecteuler.net
>
>
>
> 4) Build a spell checker, using a combination of a standard
>
> dictionary-list and custom entries. Bonus question - Make it smart
>
> enough to only spell-check comments and literal strings, when applied to
>
> files with an extension of .py
>
>
>
>
>
> --
>
> DaveA


How hard would it be to change one file to another and would it be a small-medium sized program?

 
Reply With Quote
 
 
 
 
eli m
Guest
Posts: n/a
 
      02-26-2013
On Monday, February 25, 2013 10:15:24 PM UTC-8, Dave Angel wrote:
> On 02/25/2013 10:48 PM, eli m wrote:
>
> > On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:

>
> >> Any small program ideas? I would prefer to stick to command line ones. Thanks.

>
> >

>
> > Thank you guys for the suggestions. Any more?

>
> >

>
>
>
> There are all kinds of things you could do. First, consider something
>
> that might be useful.
>
>
>
> 1) checksum all the files in a directory tree, using various checksum
>
> algorithms.
>
>
>
> 2) Convert one kind of file to another.
>
>
>
> 3) Calculate time between two dates
>
>
>
> 4) Write some part of a backup system. For example, copy files from a
>
> directory tree into a specified directory, stopping when the size totals
>
> N.N gig, and keeping track of which files have been so processed, so
>
> that after burning that directory to DVD, you can repeat the process.
>
> As a bonus, add a utility & datafile to the top of that directory, so
>
> that the DVD can be self-checking.
>
>
>
> Then try something interesting:
>
>
>
> 1) find the nth prime, for example the 1000th prime
>
>
>
> 2) Find all perfect numbers under a trillion
>
>
>
> 3) solve the puzzles on http://projecteuler.net
>
>
>
> 4) Build a spell checker, using a combination of a standard
>
> dictionary-list and custom entries. Bonus question - Make it smart
>
> enough to only spell-check comments and literal strings, when applied to
>
> files with an extension of .py
>
>
>
>
>
> --
>
> DaveA


How hard would it be to change one file to another and would it be a small-medium sized program?

 
Reply With Quote
 
 
 
 
Joshua Landau
Guest
Posts: n/a
 
      02-27-2013
On 26 February 2013 22:47, eli m <> wrote:

> How hard would it be to change one file to another and would it be a
> small-medium sized program?
>


How do you want to change it? Like rename a file (os.rename)?

 
Reply With Quote
 
eli m
Guest
Posts: n/a
 
      02-27-2013
On Tuesday, February 26, 2013 4:22:10 PM UTC-8, Joshua Landau wrote:
> On 26 February 2013 22:47, eli m <techg...@gmail.com> wrote:
>
>
>
>
>
> How hard would it be to change one file to another and would it be a small-medium sized program?
>
>
> How do you want to change it? Like rename a file (os.rename)?


I want to change the file type.
 
Reply With Quote
 
eli m
Guest
Posts: n/a
 
      02-27-2013
On Tuesday, February 26, 2013 4:22:10 PM UTC-8, Joshua Landau wrote:
> On 26 February 2013 22:47, eli m <techg...@gmail.com> wrote:
>
>
>
>
>
> How hard would it be to change one file to another and would it be a small-medium sized program?
>
>
> How do you want to change it? Like rename a file (os.rename)?


I want to change the file type.
 
Reply With Quote
 
Dave Angel
Guest
Posts: n/a
 
      02-27-2013
On 02/26/2013 05:47 PM, eli m wrote:
> On Monday, February 25, 2013 10:15:24 PM UTC-8, Dave Angel wrote:
>> On 02/25/2013 10:48 PM, eli m wrote:
>>
>>> On Friday, February 15, 2013 7:22:41 PM UTC-8, eli m wrote:

>>
>>>> Any small program ideas? I would prefer to stick to command line ones. Thanks.

>>
>>>

>>
>>> Thank you guys for the suggestions. Any more?

>>
>>>

>>
>>
>>
>> There are all kinds of things you could do. First, consider something
>>
>> that might be useful.
>>
>>
>>
>> 1) checksum all the files in a directory tree, using various checksum
>>
>> algorithms.
>>
>>
>>
>> 2) Convert one kind of file to another.
>>
>> <snip>
>>

>
> How hard would it be to change one file to another and would it be a small-medium sized program?
>


Depends on the kinds of the two files. To convert an Excel spreadsheet
file to a csv file might be a lot of work, thousands of lines, not to
mention having to dig up the docs. But to convert a DOS text file (with
lines ending cr/lf) into a Unix text file (with lines ending lf) would
be a dozen lines, shrinkable to 3 with lots of experience. (And I'd
probably prefer the dozen line version)

Other conversions might be somewhere in between. You could do data
compression, like bzip, using the modules in the standard library.

Note that utility commands may exist, but it can be instructive to do it
"by hand" anyway, to learn how.

Look at the following libraries, and see how you could write the glue to
make them into useful file conversion utilities. Then test them against
the standard equivalents, to make sure your code really work.
alib, gzip, bz2, zipfile, tarfile, csv, ConfigParser, robotparser, ...



--
DaveA
 
Reply With Quote
 
Chris Angelico
Guest
Posts: n/a
 
      02-27-2013
On Wed, Feb 27, 2013 at 2:27 PM, Dave Angel <> wrote:
> But to convert a DOS text file (with lines ending cr/lf) into a Unix text
> file (with lines ending lf) would be a dozen lines, shrinkable to 3 with
> lots of experience. (And I'd probably prefer the dozen line version)


Code golf!

open("outfile","wb").write(open("infile","rb").rea d().replace("\r",""))

No particular reason, and I'd probably prefer a 3-6 line version of
it, but it's fun to do it as one

ChrisA
 
Reply With Quote
 
eli m
Guest
Posts: n/a
 
      03-18-2013
Any other ideas?
 
Reply With Quote
 
Mark Lawrence
Guest
Posts: n/a
 
      03-19-2013
On 18/03/2013 23:51, eli m wrote:
> Any other ideas?
>


How about coming up with a new message passing syntax for objects? I
understand from recent postings that this should be fairly easy

--
Cheers.

Mark Lawrence

 
Reply With Quote
 
PMT
Guest
Posts: n/a
 
      03-28-2013
Em sábado, 16 de fevereiro de 2013 03h22min41s UTC, eli m escreveu:
> Any small program ideas? I would prefer to stick to command line ones. Thanks.


What about this one?

Do you know how to do the elevator simulation?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Small improvements ideas ? Chris Ruby 6 09-09-2010 06:13 AM
small lock/security box ideas? Brian Computer Support 5 06-15-2007 02:08 PM
Small cameras getting too small? GRL Digital Photography 50 02-03-2006 03:12 AM
Small Square with small red X Peter Coddington Computer Support 4 01-03-2006 06:58 AM
Ideas for a small business venture Steven Computer Support 0 11-14-2003 12:56 AM



Advertisments