Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 23 Nov 2014, 21:38
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to program in Puppy?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [13 Posts]  
Author Message
ViejoVizcacha

Joined: 04 Apr 2011
Posts: 4

PostPosted: Mon 04 Apr 2011, 14:56    Post subject:  How to program in Puppy?  

Hi. I just run Puppy 5.1 from CD on a T30 Thinkpad without hard-drive, and plan to use a USB for my files and for my compiler. I am poor and have no other computer available.
I know a bit of logic of programming and always wanted to program in C, but had to survive instead.
Since Puppy is so powerful as I heard it and am confirming, I chose it to start my adventures in programming.
Something I cannot figure out is how to create a screen with many fields, each one with its own row/col position and attributes and then prompt the screen on C.
Could you please give me a lead, or samples to follow?
Any help and suggestion will be thankfully absorbed.
Thank you for your attention.
Back to top
View user's profile Send private message 
nooby

Joined: 29 Jun 2008
Posts: 10557
Location: SwedenEurope

PostPosted: Mon 04 Apr 2011, 17:15    Post subject:  

I am surprised none have wanted to help you, me now writing something maybe even make that harder. I guess you need to check how much RAM memory one need for the overhead of doing C++ programming when the compiler run. I guess you would need at least 512 MB or more???

I trust you should start using the wellminded search and look for threads about C programming. Most likely you need the Dev for Developer extensions?
So search for that one too and see if your USB can have it without getting into trouble.

http://www.wellminded.com/puppy/pupsearch.html
Here is a wikka on how to use puppy to compile in C.

http://puppylinux.org/wikka/compiling

They have this important text

Quote:
Appendix 1
To convert Puppy into a complete compiler environment it is necessary to acquire a special SFS file that corresponds with the version of Puppy Linux that will be used for compiling. The file has "devx" in its name.


So first you need to decide on which puppy that suites your computer bet with regard to how much RAM memory you have.

I would add a Swap file so you can have some margin and not get hang when it use more RAM than you have.

Beware that Flash memoryies still even if they are better now due to them try to randomly spread the usage of bits they still wear out after some 100,000 writes to a bit. So I would prefer you find a scrapyard that have relatively old computers where you can fine a HDD that works in your computer. Maybe not so easy.

Or get in contact with a firm that give you an old decent computer.
That is more a hit and miss but sometimes do work out if you tell them your interest in getting to know how to program. Sorry that could be difficult if you live where there are few such rich firms with kind managements.

Sometimes schoolteachers knows about such firms.

Others than me have to take over and help you further I wanted you to feel wellcome. Tell more about your computer.

How much RAM does it have and how big is your USB Flash?

_________________
I use Google Search on Puppy Forum
not an ideal solution though
Back to top
View user's profile Send private message 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Mon 04 Apr 2011, 18:27    Post subject:  

Why don't you give Bacon a try:

http://basic-converter.org/

http://bkhome.org/bacon/

http://www.murga-linux.com/puppy/viewtopic.php?t=48901

You write code in a BASIC style language, then convert it to C using the 'bacon' converter (which also compiles the code).

Its also pretty easy to create a gui using the HUG library listed on the basic-converter site.

Basically, anything you can do in C can be done in bacon....only easier Cool
Back to top
View user's profile Send private message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 534

PostPosted: Mon 04 Apr 2011, 22:10    Post subject: Re: How to program in Puppy?  

ViejoVizcacha wrote:
Hi. I just run Puppy 5.1 from CD on a T30 Thinkpad without hard-drive, and plan to use a USB for my files and for my compiler. I am poor and have no other computer available.
I know a bit of logic of programming and always wanted to program in C, but had to survive instead.
Since Puppy is so powerful as I heard it and am confirming, I chose it to start my adventures in programming.
Something I cannot figure out is how to create a screen with many fields, each one with its own row/col position and attributes and then prompt the screen on C.
Could you please give me a lead, or samples to follow?
Any help and suggestion will be thankfully absorbed.
Thank you for your attention.


Before setting out to do the complex stuff do some simple things. You can write the classic "Hello world" program just to see that you can make a program.

For many things the best way to go is to break the user interface question away from the doing the work question. I would write a program that does what you want using the stdin as the control. Once you make it work then you can use gtkdialog to wrap it in a user interface.
Back to top
View user's profile Send private message 
ViejoVizcacha

Joined: 04 Apr 2011
Posts: 4

PostPosted: Tue 05 Apr 2011, 13:35    Post subject: Just to acknowledge receipt, since I could not make time...
Subject description: ... to dedicate to my dreamt C.
 

Nooby:
Thank you very much for your concerns. Specially for your welcome. And for your sensible suggestions.
My recently gotten ThinkPad has the following characteristics:
Intel Pentium-4 1.8GHz, 774MB of memory, 1024x768 display, CD-RW, 2 USB (rev 02) ports, Serial, Parallel, PRO/Wireless 2200BG, and a 82801CAM PRO/100 VE Ethernet. And its battery runs a whoopie 20 minutes!
I will use a generic 4GB flash. And I will take caution with the (for me new) pendrive delicate life expectancy.
About devx for my Puppy 5.1.1, I found out this :
http://distro.ibiblio.org/quirky/wary-5.1.1/wary_devx_511.sfs
Md5sum: 0004010204ac4d74dfa8b60a18b8b615 (I' have to figure out if I need to check-sum the Md5sum.)
What I do not know is whether is appropriate to download devx to the flash, since the "complete compiler environment" would be, in my mind, the CD with the OS plus the flash, in two devices? Or the flash would be the whole "compiler environment" using the Puppy in memory? I'll have to figure this out doing it.
What I could not find any reference to, was "Dev for Developer extensions". I'll search more thoroughly later. Or perhaps illumination will come in the doing.
I will try to avoid the investment of approx $50 in an Ebay 40GB 44-pins-HD, for the moment though. In my fantasy, me and my pendrive, going into the world carrying in my pocket a whole OS plus the ability to program an interactive application on the go for the amazement of my neighbor at the internet-cafe, will get me rich and famous.
About Swap file, I found out http://www.murga-linux.com/puppy/viewtopic.php?t=63585 with a suggestion like "is not needed above 512Mb memory", and carrying also this code for creating the Swap:
========if [ "$PUPMODE" = "12" ];then
if [ -f /initrd/mnt/dev_save/pupswap.swp ];then
echo -n "Activating swap file /initrd/mnt/dev_save/pupswap.swp..." >/dev/console
swapon /initrd/mnt/dev_save/pupswap.swp;check_status $?
else
#only create a swap file if no swap partition...
if [ "`free | grep 'Swap:' | tr -s " " | cut -f 3 -d " "`" = "0" ];then
#v2.02final for now, no auto creation of swap on ntfs partition...
if [ ! "`echo -n "$PUPSAVE" | cut -f 1 -d ',' | grep --extended-regexp 'msdos|vfat|ext2|ext3|reiserfs|minix'`" = "" ];then
'so serie 2 use after 2.02 seem to use swap file but not to create it..'
and running pizzapup (with really puppy 2.14 inside ) i find in /etc/rc.sysinit=========== ... and more.
I still think your proposal of regularly adding the swap is the best, and I will try to insert it in my environment and habits.

2lss:
I will try Bacon, and think will be helpful in my internal-need to be able to figure out how C handles screen-interchange/formating, since a conversion of a BASIC screen would teach me row/column-fields-positioning on C, if I understand it correct. Thank you very much for your help.

Moose On The Loose:
You are right, I should learn basics first. And I will. As soon as I get my hands in a compiler.
I agree with the convenience to look at the program as interface and work 'entities', each with its own dedication and tests. I sense that that is the way you guys do it, but nobody has slapped my head yet and showed me: See? "Do it like this and like that. Do it." and that is my stuck. I think you are stirring me to illumination, when you mention using the gtkdialog instruction? kind of "i/o port command" in my mind, which would send and retrieve a whole screen built up separately in other time(other software?), if I understand it correctly. I guess 'stdin' is the C definition of keyboard, being 'control' the C flow of execution, and these instructions will help me to 'google the going'.
Again, my thanks to all of you. I will post as I go.
Back to top
View user's profile Send private message 
2byte

Joined: 09 Oct 2006
Posts: 357

PostPosted: Tue 05 Apr 2011, 14:57    Post subject:  

ViejoVizcacha

About a swap file. It's easy to make and use one. A swap partition isn't a requirement.
To create a 512 MB swap file:
dd if=/dev/zero of=my.swp bs=1M count=512
mkswap ./my.swp

To use the swap file on a USB mounted as /mnt/sdc1:
swapon /mnt/sdc1/my.swp

Whether a swap file is needed or not depends on what apps are loaded and what they are doing. For instance, Puppy crashed on me once without a swap file when I used Rox to look at a Windows directory with a huge number of files in it. I also had Open Office loaded with a large document, was downloading a video from youtube, had Thunderbird email loaded and Firefox with a bunch of tabs open. That machine had 750 MB of memory too. Consider a swap file to be insurance as it will only be written to if it is necessary.

FWIW

_________________

Back to top
View user's profile Send private message 
nooby

Joined: 29 Jun 2008
Posts: 10557
Location: SwedenEurope

PostPosted: Wed 06 Apr 2011, 07:14    Post subject:  

ViejoVizcacha thanks for kind words.

I know too little but as you are aware of the Devx seems too big indeed.

What about the following thread then? some 6 pages where they talk about C/C++ programming using puppy OS so hopefully they do talk about using small memory and maybe maybe even USB but I ahve not read it but hope it should give example on how others have done it.

http://www.murga-linux.com/puppy/viewtopic.php?search_id=446169675&t=28629
C/C++ Development in Puppy Linux

I know too little so I friendly bow out of the thread and hope those that do programming find your thread and them share experiences or you have to find them and ask them using PM maybe.

_________________
I use Google Search on Puppy Forum
not an ideal solution though
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Wed 06 Apr 2011, 07:32    Post subject:  

Dear ViejoVizcacha,

Welcome to the kennels. Ted Dog has packaged up bacon and tcc in about 770k, which will give you a minimal compiling environment, without the need for devx. Tcc will work for C programming and BaCon and tcc for BaCon. Please be aware that the bacon binaries generated in this fashion are ridiculously large, but they work. Gcc does a much better job, or some tcc optiions need to be invoked so that the binaries are kept small.

Here is the link:

http://www.murga-linux.com/puppy/viewtopic.php?search_id=1215111891&t=65837

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 534

PostPosted: Wed 06 Apr 2011, 10:28    Post subject:  

nooby wrote:
ViejoVizcacha thanks for kind words.

I know too little but as you are aware of the Devx seems too big indeed.

What about the following thread then? some 6 pages where they talk about C/C++ programming using puppy OS so hopefully they do talk about using small memory and maybe maybe even USB but I ahve not read it but hope it should give example on how others have done it.

http://www.murga-linux.com/puppy/viewtopic.php?search_id=446169675&t=28629
C/C++ Development in Puppy Linux

I know too little so I friendly bow out of the thread and hope those that do programming find your thread and them share experiences or you have to find them and ask them using PM maybe.


There is a tool that lets you add an SFS on the fly. You could perhaps only include the devx when you need to compile. You can make a swap file on the memory stick or a harddisk and if the compile process needs the memory it would get used. The result would be very slow operation but it would not fail. Once the program is compiled, you no longer need the devx.

I have found that I spend way more time composing a program than compiling. Your experience is almost certain to be like mine. I also make certain rules that I impose on myself that help to reduce the number of times I need to pass it through the compiler:

(1) Comment each function with what it accepts of each argument

(2) Check all calls for the passed things being what is required.

(3) Avoid variables called i,j,k or x,y,z unless that is the natural name for what you are using.

(4) Settle on a standard way to spell things like:
"percent" is the name I use not "percentage"

The last one takes a little explaining. We seem to remember concepts and not words so if you use two words that are a lot alike and mean sort of the same thing you will mix them up. The most common problem at compile time (I find) is a wrong variable name.
Back to top
View user's profile Send private message 
2lss

Joined: 20 Sep 2009
Posts: 225

PostPosted: Wed 06 Apr 2011, 13:10    Post subject: Re: Just to acknowledge receipt, since I could not make time...
Subject description: ... to dedicate to my dreamt C.
 

ViejoVizcacha wrote:

My recently gotten ThinkPad has the following characteristics:
Intel Pentium-4 1.8GHz, 774MB of memory, 1024x768 display, CD-RW, 2 USB (rev 02) ports, Serial, Parallel, PRO/Wireless 2200BG, and a 82801CAM PRO/100 VE Ethernet. And its battery runs a whoopie 20 minutes!
I will use a generic 4GB flash. And I will take caution with the (for me new) pendrive delicate life expectancy.


You should be ok running puppy + devx on the flash drive. With 774 MB of memory you could get away without a swap partition/file for doing small things. My eeepc has 512 MB ram and I am able to run puppy + devx on a two gb sdcard without swap. I can compile bacon programs, and moderately sized C programs (never tried anything big).

ViejoVizcacha wrote:

About devx for my Puppy 5.1.1, I found out this :
http://distro.ibiblio.org/quirky/wary-5.1.1/wary_devx_511.sfs .


As far as I know, that is the wrong devx. Wary is a derivative of puppy, and (I think) uses a different kernel. Try this instead:

http://distro.ibiblio.org/pub/linux/distributions/puppylinux/puppy-5.1.1/lupu_devx_511.sfs
Back to top
View user's profile Send private message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2668
Location: USA

PostPosted: Thu 07 Apr 2011, 12:46    Post subject: Re: How to program in Puppy?  

ViejoVizcacha wrote:
Hi. I just run Puppy 5.1 from CD on a T30 Thinkpad without hard-drive, and plan to use a USB for my files and for my compiler. I am poor and have no other computer available.
I know a bit of logic of programming and always wanted to program in C, but had to survive instead.
Since Puppy is so powerful as I heard it and am confirming, I chose it to start my adventures in programming.
Something I cannot figure out is how to create a screen with many fields, each one with its own row/col position and attributes and then prompt the screen on C.
Could you please give me a lead, or samples to follow?
Any help and suggestion will be thankfully absorbed.
Thank you for your attention.


I believe that if you add in the devx sfs file for your Puppy version, and reboot (you have to do this "add" thru a menu option), that you have a C compiler available.

You can also get gfortran, which also requires the devx file.

However, I don't believe that there are visual/gui editor/compilers available (command line tools).

_________________
Add swapfile
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2578
Location: www.eussenheim.de/

PostPosted: Fri 08 Apr 2011, 16:14    Post subject:  

Quote:
going into the world carrying in my pocket a whole OS plus the ability to program an interactive application on the go for the amazement of my neighbor at the internet-cafe

Your neighbor might be more impressed by a multilingual wary in his language ? Smile
Back to top
View user's profile Send private message 
ViejoVizcacha

Joined: 04 Apr 2011
Posts: 4

PostPosted: Fri 08 Apr 2011, 22:56    Post subject: Sorry for the disappearance.  

I get late and tire-eyed at home, but am very happy and thankful to all of you and for your suggestions that will get me going, this weekend. Meanwhile, please receive my greetings and good wishes.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [13 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1092s ][ Queries: 12 (0.0073s) ][ GZIP on ]