Code snippet repository?
Graham Stabler
Posts: 2,510
The object exchange is pretty awesome but I was wondering if we could start a thread for short pieces of useful code that might be inserted into other programs rather than being objects themselves. I or example have a few functions I use often in my programs for basic data entry, I also have some assembly for some basic 64bit operations that became subroutines. Or even super simple functions like "putcursor(x,y)" which I made for putting the cursor in the correct place when using text rather than having two out commands.
Just a thought I'm not sure how it would work out, discuss.
Graham
Just a thought I'm not sure how it would work out, discuss.
Graham
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.co.uk
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
BTW: I type as I'm thinking, so please don't take any offense at my writing style
therefore let us bless one another,
Mark
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.
Parallax, how about a section in the obex?? Pretty please... [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
I think it is a great proposal that Graham made: the absolute best would be to have some sort of classification (or subdivision) for the code snippets. It would avoid the anarchy found on some other sites and it would be MUCH easier to find something.
Also, some sort of mechanism should be put in place so we can complement, correct or augment on a said snippet without having to follow a whole thread and try to piece everything back together. It would be less intimidating (read 'humble') for some of us that don't feel comfy at the idea of posting a whole spin... For example, I'd like to contribute routines on the several peculiar ICs I use in the course of my work but they're certainly not at such a high flying class of coding that they couldn't be improved. However, they do work!
In any case, Graham's suggestion would add tremendous functionality to the Propeller (and perhaps reduce the number of repetitive threads about the same questions over and over - I'm the first guilty of it!).
Cheers,
Alex
4Alex has a good point too, in that classifying it in a similar way as the obex would help everyone find what they're looking for. I have a couple routines to submit myself if it ever becomes a reality
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
~Some men see things as they are and ask "why?"
I dream of things that never were and ask "why not?"~
We could use the Propeller Wiki propeller.wikispaces.com
which would allow edits from multiple users.
I have several routines which I use. I'm positive that there are
better ways to accomplish the same tasks, coders better than I may
have refinements. The wiki approach would permit this.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.co.uk
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
BTW: I type as I'm thinking, so please don't take any offense at my writing style
Interesting idea. Ultimately, it seems some kind of obex-like site for posting these snippits would be handy, but we'd want some definite separation between the current obex objects and snippits. We'll have to consider this much more and see if there is something more practical we can do to help "house" it for the Propeller community.
In the meantime, it seems that a wiki is probably the most practical place to share and collaborate on such things, so by all means, try that out. We will let you know if we come up with a better solution by posting to the Propeller forum.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Jeff Martin
· Sr. Software Engineer
· Parallax, Inc.
(After I recover from the Expo.) [noparse]:)[/noparse]
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
Of course the "snippets" appear to be more application specific, but most will have "DNA" elements. The greater community would most likely be well served by having a "tool-kit" of generic Propeller DNA as at least a subsection of the "snippets". There are several bright software engineers here whom I'm sure would be happy to give and show off a little too.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
-dan
Ron
Just recently i was viewing a i2c driver that was conveniently in spin, to drive a mcp23017 i/o expander. i was able to follow that to understand how i2c data is sent out. Though how to use the mcp23017 and i2c, i was really confused on, i searched all over til i found a forum post on someone doing something similar which pointed me in the right direction, after a while of some trial and error i finally figured it out. if it wasnt that little snippet the guy posted, i dunno if i would of figured it out or how long it would of taken. The data sheets really confuse me still, as im still a complete electronics newbie.
In my opinion is a good fit.
Massimo
I feel somewhat out of place being new and all. But I would like to propose the following additions to the Propeller wikispaces to create a Propeller Snippet & DNA repository. All I need to do it is a few 'Green Lights', also suggestions ideas. Or just tell me to leave it alone and I am out of my league.
Propeller Snippets & DNA (to be added under Software)
Spin
PASM
C
BASIC
For each Language a new page with the categories below:
Re-curing Questions Explained
Snippets pertaining to all
Data Storage
Human Input
Motor Control
Speech & Sound
Tool
Protocol
Sensor
Fun
Display
Math
Signal Generation & Processing
Each category would link to a new page for users to list their
their Snippet and create a link to it.
Let me know what you think. I'll either get to work on it. Or mind my own business.
Inspiration "If you build it they will come"
EDIT: Never mind such a thing exist I just never saw it. It can be found under Released Projects/Object Reference. I guess it just doesn't get used often.
-Ron
So, here is a thought...
Someone can start a thread "Code Snippets for the Parallax Propeller P8X32A Chip" - please use the full title because it will find it's way into google, etc, too.
I suggets along the lines of my Prop Tools thread http://forums.parallax.com/showthread.php?106790-Prop-Tools-under-Development-or-Completed-(Index) but the code is within the post with a heading at the top of each post. Once this grows enough, perhaps we can get Parallax to make it a sticky or add it into one of the two stickies we have in the forum.
This would be much easier for everyone to contribute to. I would start the thread with instructions for it's use if you like, or anyone could jump in.
Your thoughts???
I don't think a direct copy of the OBEX would be good for snippets, some may be only a few lines long and so would be better displayed on a page (via some other script system no doubt). It probably would not need much modification however but it would need to format the code properly.
Cluso99,
I agree about the wiki, I feel bad about it but I don't visit it and have no desire to add anything to it, whatever is created should be more local and more Parallaxian. A thread would only work if carefully moderated so that chat could be trimmed as required, even then it would be messy and disorganized.
Graham