Roelof said:
Here are my solutions to exercise 1.
https://github.com/roelof1967/homework/tree/master/chapter1
https://github.com/roelof1967/homework/tree/master/chapter4
I hope someone has the time to look at these and give me feedback.
This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.
Task: Installing Ruby
Windows: Download and install Ruby using RubyInstaller
OS X: Ruby is already installed!
Ubuntu Linux: At the command line: sudo apt-get install ruby
Reading Assignment: LtP Chapters 0-4
Installing Ruby, Numbers, Letters, Variables & Assignment, Mixing It Up
Exercises: "A Few Things to Try" from LtP: Chapters 1 & 4
Submit exercises via GitHub, as described in this guide.
Here are my solutions to exercise 1.
https://github.com/roelof1967/homework/tree/master/chapter1
https://github.com/roelof1967/homework/tree/master/chapter4
I hope someone has the time to look at these and give me feedback.
I've added some of my examples from the first four chapters https://github.com/davidodowd/coursework
Looks good, how did you come to the number on line 2 in https://github.com/narendahr15/coursework/blob/master/ex1b.rb
Nice to see some C code in there :)
If you didn't know Ruby is an interpreted language like PHP in C
Also you should put some space between your '=' operator and your vars for readability.
I couln't insert to my files to git hub , it throws error permission denied public key,
swarnal@swarnal:~/LTP$ git init
Initialized empty Git repository in /home/swarnal/LTP/.git/
swarnal@swarnal:~/LTP$ git add 1pgm
swarnal@swarnal:~/LTP$ git commit -m "first commit"
[master (root-commit) 7f0077b] first commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 1pgm
swarnal@swarnal:~/LTP$ git remote add origin git@github.com:swarnankl/swarna-p2pUassignment.git
swarnal@swarnal:~/LTP$ git pull origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
swarnal@swarnal:~/LTP$ git push -u origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Thanks
swarna
Have you set up git? https://help.github.com/articles/set-up-git
What OS are you using?
Anymore luck with this problem?
please try adding github to your list of safe ssh domains.
This can be done with
ssh -T git@github.com
SSH will bark-no worries: simple accept the prompt with a 'y' or 'yes' if you like typing.
After that check your ssh permissions to ensure your key is actually being picked up by your system:
ssh-add -l
Please post the results of both commands
Hi,
I've done the first three excercises in chapter 1 (the chocolate one was too silly and I didn't understand the last one :/ ).
https://github.com/tardigrader/coursework/blob/master/a_few_things_to_try_1.rb
All the best,
Krister
Oh, and here's the ones from chapter 4:
https://github.com/tardigrader/coursework/blob/master/first_middle_lastname.rb
https://github.com/tardigrader/coursework/blob/master/favorite_number.rb
Looks great. For formatting of your code you may want to put some space between your '=' operator and your variable so other programmers will be able to pick up what you have written.
Yes, that would make it more readable. Thank you, Andre.
You can find it here http://pine.fm/LearnToProgram/
Exersice 1, should be:
https://github.com/Frankly3D/LearnRuby
the one with the extension.
Havn't figured out how to delete the other as yet.
Got the delete sorted, always just after I post :(
To delete files from you repo you can do this
$ git rm <filename>
or if you want to remove files from your repo but not delete it from disk you can do
$ git rm --cached <filename>
So far everything looks good, as for your age in seconds problem. Use ruby to calculate your age to seconds instead of thinking about the answer. Let the computer to the work for you.
Hint
Age / Days in Year / Hours in Day / Seconds in Hour
Hey All - here is my week 1 homework. That was fun! Thanks again for all the help!
https://github.com/hwangpet/coursework
Excellent, everything looks great. I'm glad you got your ruby build working.
Hi I have just uploaded the first weeks exercises to Github. Location is
https://github.com/cylons/coursework Sorry it's a bit late.
In the first exercise I have used constants for hours in day etc. According to my Ruby book constants should start with capital letter and "unlike most other programming languages" are mutable i.e. can be changed. I find it slightly amusing to have constants that can be changed.
It reminds me of the old programmers lament "Constants aren't and Variables won't!"
Any comments welcome.
Looks good Tony. Your right about the constants in ruby, its best practice to let those values remain unchanged.
The best practice method of writing constants in ruby is this
MY_CONSTANT_VARIABLE
aka screaming snake case
not
MyConstantVariable
aka Camelcase
Camelcase must be used for classes and modules
check out the ruby-style-guide
I'm having some trouble adding my program to the coursework using git. I'm really new to all of this so I'm probably just doing something dumb.
Basically, I'm trying to add my week.rb from my documents folder to the coursework. Check out the error I'm getting below. Any thoughts?
Command I am running:
Peters-MacBook-Air:coursework hwangpet$ git add /Users/hwangpet/Documents/Week1.rb
Error I get:
fatal: '/Users/hwangpet/Documents/Week1.rb' is outside repository
It looks as if Documents isn't a working git repo. My suggestion would be to do this:
1) Navigate to your Documents folder, then run this command.
$ git clone git@github.com/hawngpet:coursework.git
This way you have a working copy of your github repo on your harddrive.
Now you can perform the usual workflow
$ git add . or $ git add filename $ git commit -m 'your message' $ git push origin master
Tried without luck. See below. I might spend some time with some of my engineers tommorrow to see if they can help:
Last login: Mon Mar 19 21:59:02 on ttys002
Peters-MacBook-Air:~ hwangpet$ ls
Desktop Downloads Movies Pictures coursework
Documents Library Music Public tutorial.txt
Peters-MacBook-Air:~ hwangpet$ cd Documents
Peters-MacBook-Air:Documents hwangpet$ ls
About Stacks.lpdf firstprog.py webpage.html
Battle of the Exes.ods margy_picks.xls week1_numbers.rb
calc.rb peter_hwang_picks.xls
Peters-MacBook-Air:Documents hwangpet$ git clone git@github.com/hawngpet:coursework.git
Cloning into 'coursework'...
ssh: Could not resolve hostname github.com/hawngpet: nodename nor servname provided, or not known
fatal: The remote end hung up unexpectedly
Submitted exercises for Week 1 via Github: http://github.com/sedmonds/p2pu_ltp
I appreciate all coding-related feedback. Thanks and have an excellent week.
Alright lads, happy Paddy's Day from Dublin, Ireland!
Here's my attempt at the questions for LTP: https://github.com/rudedoc/coursework-week1
Hi All.
Please find my week1 assignment at the following address:
https://github.com/haithamgasim/coursework/tree/master/p2pu/intro_to_ruby
Comments will be much appreciated.
Thanks.
Haitham
Hi Guys,
Please find my week1 assignment. Wow, I have just written my first Ruby programs! :-)
I would appreciate any comments and suggestions. Here is a link to the assignment:
https://github.com/JakubJarosz/RubyP2PU/tree/master/ltp-week1
Thanks,
Jakub
Looks great Jakub! Keep up the good work.
Hi everyone!
Please find my week one assignment here. Please ask me questions. I am not exactly a complete Ruby nuby, but I certainly am not that far from the beginning. Besides, being new means you can ask all kinds of questions =)
link: https://github.com/Rhodee/ltp-p2pu
Cheers,
rhodee
When you have finished your assignment and posted to Git, please leave a link here to your repo of the current assignment to let us know your down and for review.