Official Programmers Thread

  • Christian Chat is a moderated online Christian community allowing Christians around the world to fellowship with each other in real time chat via webcam, voice, and text, with the Christian Chat app. You can also start or participate in a Bible-based discussion here in the Christian Chat Forums, where members can also share with each other their own videos, pictures, or favorite Christian music.

    If you are a Christian and need encouragement and fellowship, we're here for you! If you are not a Christian but interested in knowing more about Jesus our Lord, you're also welcome! Want to know what the Bible says, and how you can apply it to your life? Join us!

    To make new Christian friends now around the world, click here to join Christian Chat.
G

greatkraw

Guest
#61
that was not the problem

the problem was appending objects to the list without appending the attributes
I didn't understand that part
maybe you gave them what they wanted

as long as you had the init function for each class

they know there are any number of ways to create the objects
 
W

wwjd_kilden

Guest
#62
yea, our teacher claimed we would pass if we manages to make classes with init + set and get functions, so I hope he was right about that :p
 
G

greatkraw

Guest
#63
tell us about all your exams please astrid
 
Jan 8, 2009
7,576
23
0
#64
oops, greatkraw has just caused someone to get a D minus hahaha. Like the time I last tried helping someone with their homework.
 
W

wwjd_kilden

Guest
#65
hehehe

I think the database was better than the other two, but I can never trust my instincts when it comes to school, so I really don't know. All of them had some questions I didn't really know how to answer, so I just answered SOMETHING hoping to be near what they wanted :p

even one of the two teachers we have in databases struggled with one of the tasks on that exam :p (we asked him about it when it was finished) I left after half an hour when he still hadn't come up with an answer :p
 
Dec 19, 2009
27,513
128
0
71
#66
In the eighties I took a couple of COBOL courses and a BASIC course, and learned how to program in BASIC on my home (Commodore 64) computer. Does that qualify me to post on this thread?
 
Jan 9, 2009
819
4
0
#67
I was a little afraid to be around computers when i was in high school. Mainly because i didn't know anything about them and instead of trying to learn; I was afraid of looking stupid.

But i was just a kid then.:confused:
 
Dec 19, 2009
27,513
128
0
71
#68
I was a little afraid to be around computers when i was in high school. Mainly because i didn't know anything about them and instead of trying to learn; I was afraid of looking stupid.

But i was just a kid then.:confused:
That’s sort of the way I was with swimming. Then one summer there was a nice teacher, and the next thing you knew, I learned how to swim.
 
Jan 9, 2009
819
4
0
#69
Of course, I grew up in rough neighborhoods where just getting thru the day without getting beat up was a challenge. After Windows came out, i started looking at computers. Then I got to the point where I wanted to learn how theyWork. Since I am a long haul truck driver I can't go to school to learn about them. So I buy books from B &N or B Dalton and learn on my own that way. And by talking to people who know about them too.
 
G

greatkraw

Guest
#70
In the eighties I took a couple of COBOL courses and a BASIC course, and learned how to program in BASIC on my home (Commodore 64) computer. Does that qualify me to post on this thread?
yeah well mentioning a C64 or Vic20 is somewhat embarrassing - what about an amiga with sidecar?
 
W

wwjd_kilden

Guest
#71
Anyone here know script programming ? (bash)

I'm having problems combining piping, variables and input :/
 
B

Belgian_Pilot

Guest
#72
No, I'm sorry. Never done that.

Can you post your question? I'm a quick learner :) Maybe I can find the answer...
 
W

wwjd_kilden

Guest
#73
hmmmmmmmmmm, my machine has lots of new shortcuts not that I have W7 :S I lost everything I just wrote -,- aaaanyway...
we just started this week, so I'm trying and failing and learning :p

I am to write a bash script that:

takes two command line parametres (these are used to search a place AND a course/ class from a list in a file)
returns the lines that have a match in both paramtres
counts and returns number of lines/matces found

----
bash works something like this:
###
#!/bin/bash
echo "prints something to screen" # prompts user to give computer input
read varname # read reads the input and makes whatever I put in place of varname point to it (like var="something")

echo "you typed $varname" # prints you typed ..and whatever the user typed in as input

# also var=$(($a+$b)) gives var the value of variables a+b and can then be called as $var


# http://www.justlinux.com/nhf/Programming/Introduction_to_bash_Shell_Scripting.html more info here
 
B

Belgian_Pilot

Guest
#74
OK, is not that hard. Tonight I have to work untill 11pm (late night at the expo), but tomorrow I'll have a look.
 
W

wwjd_kilden

Guest
#75
duuuuuuuuuuuuuuuuuuuuuuuuh! :p

it was only because the manuals were confusing me. It says over and over again that you have to put strings in " " to make the shell use the whole line (otherwise it will only take the first word) but of course if i use the search command with " " it will search for "word" not word.....:p



echo 'Dont enclose seach criteria in ""''
echo
echo "Type place name"
read place

echo "Type class name"
read class

if [ -z "$place" ] || [ -z "$class" ]; then # checks if they have zero value

echo "You must enter both a place and a class name!"
echo "Finishing! try again"
exit # quits

fi # end of if function


grep "$sted" navneliste-1.txt | grep "$studie" # search for whatever was entered in the variables in the textfile called navneliste-1
# this will return all lines matching BOTH criteria

echo "Number of hits: "
grep "$sted" navneliste-1.txt | grep "$studie" | wc -l # returns number of hits given in search

" the | pipes the answer of the first function into the next one
 
B

Belgian_Pilot

Guest
#76
You make my job very easy. Each time you have a problem, and I want to have a look to help you, you find the solution yourself!

I'm great, not? :p
 
G

greatkraw

Guest
#77
You make my job very easy. Each time you have a problem, and I want to have a look to help you, you find the solution yourself!

I'm great, not? :p
she is a natural
you can tell she is good with machines
because she is rubbish with people:D

one day astrid will approach a problem and not lack confidence

every problem you come up with someone else has already encountered
JUST GOOGLE IT
 
W

wwjd_kilden

Guest
#78
googeling didn't help :p I just tried without the quotes out of curiosity
google tells you to use quotes :p

and I've always had that ability, when I ask for help, I suddenly start seeing parts of the solution :p
will prob need more help when it gets more complicated though.
 
W

wwjd_kilden

Guest
#79
tried to figure out how on earth I am supposed to use cat or a for loop in a search

8 count=0
9
10
11 while read name
12
13 do
14 count=$((count + 1))
15 echo $navn
16
17 done < navn-1.txt
18
19 echo " "
20 echo "found $count names"
21 echo " "
___________
6 # v.1.0
7
8 teller=0 #count
9 IFS=$'\n'
10
11 for navn in $(cat navn-1.txt)
12
13 do
14 teller=$((teller + 1))
15 echo $navn
16
17 done
18
19 echo " "
20 echo "Det var $teller navn tilsammen"
21 echo " "
=======================
I am supposed to use one of those to change another assignment I did where I search a text file for two inputs, then print the lines matching both inputs

but I can't find a way to use it, because whatever argument i put behind cat, the bash shell expects to be a filename (or so it seems)
 
W

wwjd_kilden

Guest
#80
This is the file I am supposed to incorporate it into somehow:
(Am of course not looking for someone to do my homeowrk, but I could neeed an example of how to use _ for....in....cat ....stuff in this setting)

echo
echo "type name of place"
read sted #read place

if [ -z "$sted" ]; then

echo "no input given!"
echo "quit"
exit
fi

echo "search for course"
read studie # course

if [ -z "$studie" ]; then

echo "must have both name and course!!"
echo "quit"
exit
fi

grep "$sted" navneliste-1.txt | grep "$studie" # prints the matching lines (grep searches and prints lines in the text file navneliste-1.txt

echo "Antall treff: "

grep "$sted" navneliste-1.txt | grep "$studie" | wc -l # wc -l counts number of lines matching the seach

dato=$(date +%F) # date var

grep "$sted" navneliste-1.txt | grep "$studie" >"$sted$studie$dato".txt # save to file with varibales as filename
grep "$sted" navneliste-1.txt | grep "$studie" | wc -l >>"$sted$studie$dato".txt # add count to same file