That's my problem right now, really. I don't spend any time outside of class learning it, and I only open the book in class to do the exercises with the class but when I leave class, I don't do anything with it. I actually like programming too, it's just that I haven't had the motivation to do anything when I'm not really required to.
Set your self a project to complete when you're not in class. It should help you gain motivation to learn.That's my problem right now, really. I don't spend any time outside of class learning it, and I only open the book in class to do the exercises with the class but when I leave class, I don't do anything with it. I actually like programming too, it's just that I haven't had the motivation to do anything when I'm not really required to.
Hey guys. I've got a list something like this, in F#.
let answers = List.map (fun (_, ans) -> List.filter (fun c -> c = "a") ans) choice
List.map List.length answers
Set your self a project to complete when you're not in class. It should help you gain motivation to learn.
That's my problem right now, really. I don't spend any time outside of class learning it, and I only open the book in class to do the exercises with the class but when I leave class, I don't do anything with it. I actually like programming too, it's just that I haven't had the motivation to do anything when I'm not really required to.
Problem Statement
After a successful career solving all of the worlds toughest cryptography problems for Acme Cryptography Division, you have decided that you want to see the world. This is why youve requested a transfer to work for the Acme Travel Agency.
The Acme Travel Agency specializes in airline travel, and due to your quality assurance experience, you are assigned to analyze the quality of different flight plans. A flight plan consists of N connecting flights. After each flight except for the last one, there is a layover period in which the passenger must wait for the next flight. You have been tasked to calculate the destination time (without taking into account time zone changes), as well as the quality of the flight plan.
If the total time that a passenger is flying as at least two times greater than the time in layover, a flight plan is considered to be efficient. Otherwise, a flight plan is considered to be inefficient.
To calculate the destination time, add the total trip duration (the sum of all flight a layover durations) to the departure time, and calculate the corresponding time in a 24-hour clock format. Note that flight plans may last overnight, or may have a duration greater than a day. As an example, if a flight plan departed at 09:30 and lasted for 2000 minutes (thats a long flight plan!), the destination time would be 18:50 the next day. As such, you would report 18:50 as the destination time.
Input Specification
Input will begin with a line single integer, N (1 <N< 50). On the next line, you are given two integers H (0 <H< 23) and M (0 <M< 59). This denotes the departure time as H:M, the Mth minute of the Hth hour. On each of the following N-1 lines, there will be two integers, F (1 <F< 1440) and L (1 <L< 1440), where F is the duration of the flight in minutes, and L is the duration of the following layover, also in minutes. Input is concluded by one final line containing a single integer F, the duration of the final flight.
Output Specification
Your program should output the arrival time and the quality of the flight. This should be formatted in the following way:
This flight plan is S, and will conclude at HH:MM.
where S is a string: either efficient or inefficient depending on the quality of the flight as defined in the Problem Statement. HH:MM is the 24-hour time of the destination as defined in the Problem Statement.
Sample I/O
Input:
1
7 45
75
Output:
This flight plan is efficient, and will conclude at 09:00.
Input:
2
13 30
75 180
85
Output:
This flight plan is inefficient, and will conclude at 19:10.
Input:
3
12 27
500 300
600 400
300
Output:
This flight plan is efficient, and will conclude at 23:27.
Is there a good idiot's guide to Prolog?
Essentially, I know what I have to do. It's HOW to do it that's the tricky part; I'm sure that's the main problem in coding, though. I'm still not quite up to speed with loops, and since our current instructor is still a student himself, he doesn't yet have the qualities of getting his ideas and points across as thoroughly as other, more seasoned instructors.
Any ideas?
I don't know anything about C (me C++ noob), but you might get better help if you're more specific about what you're struggling with? Have you started? A good starting point, I've found, is translating the instructions into fake code, like:Hey dudes, I'm taking an intro to C class and I'm having a lot of trouble with this project:
...
Any ideas?
if timeFlying >= layover * 2
[INDENT]efficient = yes[/INDENT]etc...
#!/bin/bash
#
# Aktuelle Staatsverschuldung der BRD
# Grundlage ist ein Zuwachs / Sekunde von 4.481 (Stand 20.06.10)
let Verschuldungfix=1720690247715
let FixAbzug=5722183008431
let AktZeit=`date +%s`
let AktZeitMalZuwachsProSekunde=$AktZeit*4481
let AktuelleVerschuldung=$Verschuldungfix+AktZeitMalZuwachsProSekunde-$FixAbzug+479000
echo "PUBLIC debt of GERMANY"
echo "$AktuelleVerschuldung 
"
curl --silent "http://weather.yahooapis.com/forecastrss?p=USTX0353&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'
Why do you want to learn prolog?
This is pretty basic.
I would recommend lisp or erlang if you want to learn a functional language.
Prolog is required for the parsing course I'm having.Why do you want to learn prolog?
This is pretty basic.
I would recommend lisp or erlang if you want to learn a functional language.
if(rawData[i] == '<' && rawData[i+1] == '<'){
i+=2;
temp_string[j] = rawData[i];//-frequency;
temp_string[j] = temp_string[j]-frequency;
//i++;
//j++;
}
Your code decrements temp_string[j] by frequency. I don't know what j is or where it's coming from. And I don't know what frequency is. And I don't know if the condition in your if-statement is ever true. But assuming the condition is true, then your code should do what you expect: it changes the value of temp_string[j] by subtracting frequency.Can anyone tell me why this code isn't reassigning the value?
Code:if(rawData[i] == '<' && rawData[i+1] == '<'){ i+=2; temp_string[j] = rawData[i];//-frequency; temp_string[j] = temp_string[j]-frequency; //i++; //j++; }
What I want to do is it changes the alphabetical value of what's in temp_string by the amount that's in frequency. It doesn't seem to want to change though.
Your code decrements temp_string[j] by frequency. I don't know what j is or where it's coming from. And I don't know what frequency is. And I don't know if the condition in your if-statement is ever true. But assuming the condition is true, then your code should do what you expect: it changes the value of temp_string[j] by subtracting frequency.
long decode_msg(const char rawData[], char signal[], int third_match_val, int a, int b, int frequency ){
int i = 0;
int j = 0;
long result = 0;
char temp_string[100] = "";
for(i = third_match_val; i < strlen(rawData) || rawData[i] != '\0'; i++){
switch(rawData[i]){
case '>':
if(rawData[i] == '>' && rawData[i+1] == '>'){
i+=2;
temp_string[j] = rawData[i];//+frequency;
temp_string[j] = (temp_string[j]+frequency);
//i++;
//j++;
}
case '<':
if(rawData[i] == '<' && rawData[i+1] == '<'){
i+=2;
temp_string[j] = rawData[i];//-frequency;
temp_string[j] = (temp_string[j]-frequency);
//i++;
//j++;
}
default:
if(rawData[i] >= a && rawData[i] <= b){
printf("in between a & b ascii values!\n");
temp_string[j] = rawData[i];
j++;
}
return result;
}
Just got done with an onsite at one of the top-tier tech companies. Would anyone be interested in an overview of the process and the questions I was asked?
temp_string is a char variable while frequency is a int variable. What it's supposed to do is that if it finds two less tha nor greater than signs, it changes the next alphabetical value of it by the amount in frequency. Here's the function for it.
Code:long decode_msg(const char rawData[], char signal[], int third_match_val, int a, int b, int frequency ){ int i = 0; int j = 0; long result = 0; char temp_string[100] = ""; for(i = third_match_val; i < strlen(rawData) || rawData[i] != '\0'; i++){ switch(rawData[i]){ case '>': if(rawData[i] == '>' && rawData[i+1] == '>'){ i+=2; temp_string[j] = rawData[i];//+frequency; temp_string[j] = (temp_string[j]+frequency); //i++; //j++; } case '<': if(rawData[i] == '<' && rawData[i+1] == '<'){ i+=2; temp_string[j] = rawData[i];//-frequency; temp_string[j] = (temp_string[j]-frequency); //i++; //j++; } default: if(rawData[i] >= a && rawData[i] <= b){ printf("in between a & b ascii values!\n"); temp_string[j] = rawData[i]; j++; } return result; }
It doesn't seem to want to chage the value though.
EDIT - I think I figured out my problem >__>
There are a variety of issues with this code.
First, seems like some braces are missing.
Why are you using a switch statement?
If you are going to use a switch statement, you probably want to add 'break' to the end of your cases.
You probably want the upper limit on your for loop to be 'strlen(rawData) - 2'.
As far as I can tell, this function always returns zero, since you never change 'result' after initializing it.
You also never seem to do anything with the data stored in 'temp_string'.
Seems like you should be incrementing j every iteration...
Here's a basic overview: 5 interviewers, 45 minutes each, and a lunch on campus (the person you go to lunch with does not submit hiring feedback). Where the question was specific to a certain programming language, I've put the language in parentheses. For the record, I am a front-end programmer, primarily working in Javascript and Objective C at the moment. I have also worked with C++ on graphics libraries in the past.I would, since I'm gonna be job-searching soon.
Here's a basic overview: 5 interviewers, 45 minutes each, and a lunch on campus (the person you go to lunch with does not submit hiring feedback). Where the question was specific to a certain programming language, I've put the language in parentheses. For the record, I am a front-end programmer, primarily working in Javascript and Objective C at the moment. I have also worked with C++ on graphics libraries in the past.
This makes me fear future interviews. I recently graduated and I was looking into software development as well (though not JS and Obj. C), but I couldn't solve any of these algoritmic questions. Never did that stuff in my studies. Was this for a Senior developer job?
Okay, I took a week break off from reading Head First but I'm going to resume it and code more. I saw this site on another thread: http://www.programr.com/zone/java but it keeps giving me errors("error: exception occured.") when I submit codes that work. Which sucks since this is the only interactive java site I've found. Anyone know why this happens?
Or maybe someone can suggest sites that give exercises for java? I feel like I need to code more rather than just read and do the exercises in Head First.
This makes me fear future interviews. I recently graduated and I was looking into software development as well (though not JS and Obj. C), but I couldn't solve any of these algoritmic questions. Never did that stuff in my studies. Was this for a Senior developer job?
Public Class Form1
Dim Name, Answer As String
Dim Age As Double
Private Sub CmdEsegui_Click(sender As System.Object, e As System.EventArgs) Handles CmdEsegui.Click
Do
Age = 0
Name = InputBox("Insert you name", "Name")
Eta = Val(InputBox("Insert you age", "Age"))
If (Age >= 18 And Age < 25) Then
MsgBox("You can vote for... i referendum e alla camera dei deputati", 0, "Vote")
ElseIf (Age > 25) Then
MsgBox("You can vote for... i referendum, alla camera dei deputati e dei senatori", 0, "Vote")
ElseIf (Age <= 17) Then
MsgBox("You can't vote", 0, "Vote")
End If
Answer = InputBox("The list is over? Yes or No", "Answer")
Answer = LCase(Answer)
Loop Until (Answer = "yes")
End Sub
End Class
I such thing possible?
I don't know VB, but you can subtract dates. You get a TimeSpan, which represents a length of time. TimeSpans have a property called TotalDays which you can use to determine if it's more than the number of years you're checking for. You can also compare TimeSpans with >, <, >=, etc. And you can subtract them.Can I ask a question about some very very basic Basic here? :lol
I'm still studying and I'm still in high school so it's very superficial, but it's a start.
I was given this exercise:
You have a list of names and ages, you want to know who can vote and who can't.
So here's what I did (sorry in advance if it's done in a stupid way or something important is missing)
(Sorry for some italian)Code:Public Class Form1 Dim Name, Answer As String Dim Age As Double Private Sub CmdEsegui_Click(sender As System.Object, e As System.EventArgs) Handles CmdEsegui.Click Do Age = 0 Name = InputBox("Insert you name", "Name") Eta = Val(InputBox("Insert you age", "Age")) If (Age >= 18 And Age < 25) Then MsgBox("You can vote for... i referendum e alla camera dei deputati", 0, "Vote") ElseIf (Age > 25) Then MsgBox("You can vote for... i referendum, alla camera dei deputati e dei senatori", 0, "Vote") ElseIf (Age <= 17) Then MsgBox("You can't vote", 0, "Vote") End If Answer = InputBox("The list is over? Yes or No", "Answer") Answer = LCase(Answer) Loop Until (Answer = "yes") End Sub End Class
So basically, you give it you age and the it does "if >=..." and then it tells you if you can vote or no.
And it works. :lol
But if I wanted to do the same thing but with the age expressed as a date? Like 19/05/1990, then I'd do 2012-1990 = 22, so age = 22 and then the program goes on.
I looked up Microsoft's MDSN (I'm using Visual Studio) and I saw this Date command, that reads the current date from the system, but how do I use the date that it reads?
In particular, I'd have to substract just the current year from the one the user was born in, and then check if the day/month has already passed (because otherwise it would still be 21 in this case).
I such thing possible?
I only know about the US. It varies a lot on the area (state, city etc) and the company. I've seen people accept as low as $30k, and as high as $100k for specialized skills they developed in school. It seems somewhere around 50k is reasonable, but you could easily get 65k in other places.Btw, what's the starting salary a programmer/software developer should expect just out of graduation?
I only know about the US. It varies a lot on the area (state, city etc) and the company. I've seen people accept as low as $30k, and as high as $100k for specialized skills they developed in school. It seems somewhere around 50k is reasonable, but you could easily get 65k in other places.
But don't just take my word for it. There are a bunch of websites for such things, and other people may have conflicting experience.
A good rules is whenever you have to deal with time, never do the calculations yourself. There is always a library or method call that you can use and it'll avoid having to deal with all sorts of special cases and timezones and whatever (to a point).
Not sure what version you are using, but look up DateDiff or similar and it might sort you out.
cut
Again, I don't know VB so this is probably of limited help to you. You might try checking out some of the pages on msdn, which often have VB examples at the bottom. e.g. http://msdn.microsoft.com/en-us/lib...aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
http://msdn.microsoft.com/en-us/library/system.timespan.aspx
I only know about the US. It varies a lot on the area (state, city etc) and the company. I've seen people accept as low as $30k, and as high as $100k for specialized skills they developed in school. It seems somewhere around 50k is reasonable, but you could easily get 65k in other places.
But don't just take my word for it. There are a bunch of websites for such things, and other people may have conflicting experience.
It is quite different in Australia too.
I'd be expecting somewhere from $40-50k depending on the industry to start with but you will go up pretty quickly if you are producing the goods.
I'd expect 60-80k for intermediate with a senior getting somewhere up to around 90-120k.
It is quite different in Australia too.
I'd be expecting somewhere from $40-50k depending on the industry to start with but you will go up pretty quickly if you are producing the goods.
I'd expect 60-80k for intermediate with a senior getting somewhere up to around 90-120k.
Already have eclipse, but I guess I could try doing random projects.Why do you need an interactive java site? Download Eclipse and start coding simple tools like a console based App to do your grocery list, or keep track of a game collection.
holy shit. Is the IT industry big in Australia?
Already have eclipse, but I guess I could try doing random projects.
I'm a few years out of school, so I'm interviewing for a higher position than you would be. I'm not sure where you're looking to work, but where I currently work has an almost identical interview process to the one I described above. Virtually all of the tech giants do something extremely similar, even for kids right out of school. As others have mentioned, we don't expect you to come in and code like a pro. In a real environment, you'll obviously have other resources to aid your process, but an IDE and a search engine are not going to teach you to think critically about difficult problems. That is, by and large, why those algorithm questions are used - they're designed to take some time to solve properly and they demonstrate a number of important skills: knowledge of the language you're coding in and the data structures you're working with, the ability to communicate effectively about a problem and carefully analyze the good and bad aspects of potential solutions, etc.This makes me fear future interviews. I recently graduated and I was looking into software development as well (though not JS and Obj. C), but I couldn't solve any of these algoritmic questions. Never did that stuff in my studies. Was this for a Senior developer job?
I'm a few years out of school, so I'm interviewing for a higher position than you would be. I'm not sure where you're looking to work, but where I currently work has an almost identical interview process to the one I described above. Virtually all of the tech giants do something extremely similar, even for kids right out of school. As others have mentioned, we don't expect you to come in and code like a pro. In a real environment, you'll obviously have other resources to aid your process, but an IDE and a search engine are not going to teach you to think critically about difficult problems. That is, by and large, why those algorithm questions are used - they're designed to take some time to solve properly and they demonstrate a number of important skills: knowledge of the language you're coding in and the data structures you're working with, the ability to communicate effectively about a problem and carefully analyze the good and bad aspects of potential solutions, etc.
I would expect that as you reach higher levels, projects you've already worked on are discussed more and more. To that end, I can't emphasize enough how important it is to be able to point to projects you've undertaken outside of the confines of work and class (i.e. something you did for fun on your own time). Even with projects to point to, if you're unable to do some problem solving, that's probably going to raise red flags. One person I was part of the interview process for (who was 10 years my senior and much more experienced) didn't exactly dazzle us in his interview; he was given a chance to redeem himself with a follow-up programming problem (with a few days to complete it and send it back). For UI guys, we also have an assessment (an adaptation of Rebecca Murphey's js-assessment). Well-written code produces measurable results. It should follow that an interview for a coding job would be much less nebulous and much more measurable than one for someone looking to join a marketing department. At the end of the day, I think that is a good thing.
If you're looking to learn about the critical data structures and algorithms, I'd recommend Skiena's Algorithm Design Manual (PDF). That is the book the company I just visited recommended I review.
Another book I found very helpful in terms of going in knowing what to expect was Cracking the Coding Interview, which has a ton of example questions and answers.
To prep for this interview, I studied Skiena first, did practice problems on my whiteboard at home (nerd alert) from Cracking the Coding Interview and re-read the best book I own on JavaScript (Crockford's JavaScript: The Good Parts) and Objective C (not actually a book - I used the Stanford CS193p videos on iTunes U). At the end of the day, none of those things are going to make you a worse programmer.
There is no numRecords field in your sample input. So why are you reading in one?
This was purely following his examples so im not sure if that is even right. so how do you count the records in the file for the "for" loop?
Awesome to hear. Make sure you ask any questions as you go in here.
You read until the end of the file is reached. You can do this with the scanner class by calling: hasNextLine()
while (houseList.hasNextLine())
{
a = houseList.next();
p = houseList.nextDouble();
ar = houseList.nextDouble();
r = houseList.nextInt();
HouseList.add(a, p, ar, r);
}