Information Technology

new laptop

I am an engineering student and i need a new laptop ASAP. It needs to be able to run autocad and solid works and well as be able to be used for C programming. Ia m currently using a mac and its shit so please help ASAP

submitted by /u/Noobie9292223
[link] [comments]

Python Trivia Game Problem - AttributeError: object has no attribute

Learn Programming - 9 hours 30 min ago

I have a trivia game which runs fine for the most part except for this one error that occurs when attempting to quit the game. If the "Click to Quit" button is pushed when on the first question of the quiz (before selecting any answer), the program will freeze and the following error message will print:

Traceback (most recent call last): File "/Users/Harrison/Documents/Jeopardy/", line 132, in <module> main() File "/Users/Harrison/Documents/Jeopardy/", line 124, in main quiz_game.quiz_game_finish() File "/Users/Harrison/Documents/Jeopardy/", line 165, in quiz_game_finish self.EndScore = Text(Point(320, 200), ("Score:", self.Score)) AttributeError: 'gameboard' object has no attribute 'Score'

I am unsure of how to resolve this as I have very limited coding experience. Any and all help here would be very much appreciated!

Here is the code for the main program:

# this is the main program for the quiz game # import font, random, graphics # import the class programs import random from graphics import * from gameboard import gameboard def open_text_file(): # this function opens text file file = open("jepGame.txt", "r") file_list = file.readlines() return file_list def make_questions(screen, question_string): # this function splits the questions by a comma and makes it into multiple choice and question parts quest_str_list = question_string.split(",") question = quest_str_list[0] answer_a = quest_str_list[1] answer_b = quest_str_list[2] answer_c = quest_str_list[3] # the correct answer is in slot 4 correct_integer = int(quest_str_list[4]) correct_answer = quest_str_list[correct_integer] return question, answer_a, answer_b, answer_c, correct_integer, correct_answer def quiz_find_question(screen, file_list): # this function returns a list of Questions from a file list questions_list = [] length = len(file_list) random_integer = random.randint(0, length-1) for info_line in file_list: questions_list.append(info_line[:-1]) print(questions_list) question, answer_a, answer_b, answer_c, correct_integer, \ correct_answer = make_questions(screen, questions_list[random_integer]) file_list.pop(random_integer) print(len(file_list)) return question, answer_a, answer_b, answer_c, correct_integer, correct_answer, file_list def main(): # the main code for the program to run and call everything together # create the screen screen = GraphWin('Quiz Game', 640, 640) screen.setBackground('light blue') message = Text(Point(320, 60), "Quiz Game") message.setSize(36) message.draw(screen) # bring in the text file, mouse quiz_game = gameboard(screen) button_start, button_quit = quiz_game.begin_board() file_list = open_text_file() pt = screen.getMouse() # if the user clicks the quit button, clear the board, score and close the screen if button_quit.clicked(pt): quiz_game.clear_score() screen.close() # else, go into while loop if the other buttons are clicked else: while not button_start.clicked(pt) or button_quit.clicked(pt): pt = screen.getMouse() # if the start button is clicked, make it deactivated and begin the game if button_start.clicked(pt): button_start.deactivate() score = 0 ques_no = 0 # go through the 88 questions while not button_quit.clicked(pt) and ques_no < 2: question, answer_a, answer_b, answer_c, correct_integer, correct_answer, \ file_list = quiz_find_question(screen, file_list) ques_no = ques_no + 1 quiz_game.play_board(question, answer_a, answer_b, answer_c) pt = screen.getMouse() # if user clicks the quit button = break, clear the score if button_quit.clicked(pt): break response = quiz_game.check_answers(correct_integer, pt) quiz_game.clear_score() # keep the score, go to next question score = int(quiz_game.score_keep(score)) button_next = pt = screen.getMouse() # if next is clicked, clear the board if button_next.clicked(pt): quiz_game.clear_board(response) # elif the quit button is clicked = break elif button_quit.clicked(pt): break # else, continue with the game else: while (not button_quit.clicked(pt)) or (not button_next.clicked(pt)): pt = screen.getMouse() if button_next.clicked(pt): quiz_game.clear_board(response) break if button_quit.clicked(pt): screen.close() # clear the board, score and end quiz_game.clear_score() quiz_game.quiz_game_finish() while not button_quit.clicked(pt): pt = screen.getMouse() if button_quit.clicked(pt): screen.close() main()

Here is the ButtonClass:

# this is the button class program from graphics import* class Button: # A button is a labeled rectangle in a window. It is activated or deactivated with # the activate() and deactivate() methods. # The clicked(p) method returns true if the button is active and p is inside it.""" def __init__(self, win, center, width, height, label): # Creates a rectangular button, eg: qp = Button(myWin, centerPoint, width, height, 'Quit) # length and position for the button w, h = width/2.0, height/2.0 x, y = center.getX(), center.getY() self.xmax, self.xmin = x+w, x-w self.ymax, self.ymin = y+h, y-h p1 = Point(self.xmin, self.ymin) p2 = Point(self.xmax, self.ymax) # specifics for the rectangle buttons self.rect = Rectangle(p1, p2) self.rect.setFill('blue') self.rect.setOutline('blue') self.rect.draw(win) self.label = Text(center, label) self.label.setTextColor('black') self.label.draw(win) def button_right(self): # button is correct, make it green self.rect.setFill('green') def button_wrong(self): # wrong button chosen, make it red self.rect.setFill('red') def clicked(self, p): # Returns true if button active and p is inside return ( and self.xmin <= p.getX() <= self.xmax and self.ymin <= p.getY() <= self.ymax) def get_label(self): # Returns the label string of this button return self.label.getText() def activate(self): # Sets this button to activate self.label.setFill('yellow') self.rect.setWidth(2) = True def deactivate(self): # Sets this button in inactive self.label.undraw() self.rect.undraw() = False

Here is the gameboard:

# this is the quiz game board class from graphics import* from ButtonClass import Button class gameboard: def __init__(self, window): # the screen self.screen = window def begin_board(self): # set up the board with the specifics width = 125 height = 75 # the locations for the start and quit buttons center_start = Point(320, 320) center_quit = Point(500, 575) # label the buttons label_quit = "Click to Quit" label_start = "Click to Begin" # start button self.buttonStart = Button(self.screen, center_start, width, height, label_start) self.buttonStart.activate() # quit button self.buttonQuit = Button(self.screen, center_quit, width, height, label_quit) self.buttonQuit.activate() # score section self.ScoreText = Text(Point(100, 575), "Score:") self.ScoreText.setSize(20) self.ScoreText.draw(self.screen) return self.buttonStart, self.buttonQuit def play_board(self, question, answer_a, answer_b, answer_c): # the positions and sizes for the buttons and questions/answer options width = 500 height = 75 center_answer_a = Point(320, 250) center_answer_b = Point(320, 350) center_answer_c = Point(320, 450) # center_quit = Point(500, 600) # label the answers label_answer_a = answer_a label_answer_b = answer_b label_answer_c = answer_c # specifics self.Questo = Text(Point(320, 125), str(question)) self.Questo.setTextColor('blue') self.Questo.setSize(16) self.Questo.draw(self.screen) # specifics for each button self.buttonAnswerA = Button(self.screen, center_answer_a, width, height, label_answer_a) self.buttonAnswerA.activate() self.buttonAnswerB = Button(self.screen, center_answer_b, width, height, label_answer_b) self.buttonAnswerB.activate() self.buttonAnswerC = Button(self.screen, center_answer_c, width, height, label_answer_c) self.buttonAnswerC.activate() # return the following: self.buttonAnswerA, self.buttonAnswerB, self.buttonAnswerC, self.Questo def clear_board(self, response): # function to clear the game board and make the buttons deactivated self.buttonAnswerA.deactivate() self.buttonAnswerB.deactivate() self.buttonAnswerC.deactivate() self.Questo.undraw() response.undraw() def check_answers(self, right_answer, pt): # to check the answers and specify the colours = pt # while loop for the answer selected while (not self.buttonAnswerA.clicked( or (not self.buttonAnswerB.clicked( or ( not self.buttonAnswerC.clicked( # if statement for the correct answer, display it in green if (self.buttonAnswerA.clicked( and right_answer == 1) or ( self.buttonAnswerB.clicked( and right_answer == 2) or ( self.buttonAnswerC.clicked( and right_answer == 3): response = Text(Point(320, 160), str("Correct!")) response.setTextColor('green') response.setSize(20) response.draw(self.screen) self.ScoreAnswer = 1 if right_answer == 1: self.buttonAnswerA.button_right() if right_answer == 2: self.buttonAnswerB.button_right() if right_answer == 3: self.buttonAnswerC.button_right() break # if statement for the wrong button, have the two wrong choices display red elif self.buttonAnswerA.clicked( or self.buttonAnswerB.clicked( or self.buttonAnswerC.clicked( response = Text(Point(320, 160), str("Wrong!")) response.setTextColor('red') response.setSize(20) response.draw(self.screen) self.ScoreAnswer = 0 if self.buttonAnswerA.clicked( self.buttonAnswerA.button_wrong() if self.buttonAnswerB.clicked( self.buttonAnswerB.button_wrong() if self.buttonAnswerC.clicked( self.buttonAnswerC.button_wrong() if right_answer == 1: self.buttonAnswerB.button_wrong() self.buttonAnswerC.button_wrong() if right_answer == 2: self.buttonAnswerA.button_wrong() self.buttonAnswerC.button_wrong() if right_answer == 3: self.buttonAnswerA.button_wrong() self.buttonAnswerB.button_wrong() break else: = self.screen.getMouse() return response def score_keep(self, score): # function to keep the score of the game self.Score = score + int(self.ScoreAnswer) self.ScoreText = Text(Point(100, 575), ("Score:", self.Score)) self.ScoreText.setSize(20) self.ScoreText.draw(self.screen) return int(self.Score) def clear_score(self): # function to clear the score self.ScoreText.undraw() def next(self): # for the next button, location and size and label it center_next = Point(320, 575) width = 125 height = 75 label_next = "Next" self.buttonNext = Button(self.screen, center_next, width, height, label_next) self.buttonNext.activate() return self.buttonNext def quiz_game_finish(self): # once the user has gone through the entire game of questions: # display the score self.EndScore = Text(Point(320, 200), ("Score:", self.Score)) self.EndScore.setSize(20) self.EndScore.draw(self.screen) # display the finish statement self.EndText = Text(Point(320, 350), "You've Finished! Congrats!") self.EndText.setSize(20) self.EndText.draw(self.screen)

And lastly, here are a couple of questions from the text file:

What is the capital of Finland?, Helsinki, Santiago, Copenhagen, 1 Identify the capital of Lebanon, Jakarta, Prague, Beirut, 3

submitted by /u/MrSir333
[link] [comments]

Friday fun fact: If Stegosauruses had space telescopes, they wouldn't have seen any rings around Saturn

The Register - 9 hours 41 min ago
Bet you were expecting a rude ring pun here? Well, not today

Saturn’s characteristic rings may only be as old as 100 million years, and thus formed during a time when dinosaurs still roamed on Earth.…

Up to $800, 15.6 in (USA) laptop for student

  • Total budget and country of purchase:

$800; I'm in the USA

  • Do you prefer a 2 in 1 form factor, good battery life or best specifications for the money? Pick or include any that apply.

I don't want a 2-in-1. Battery life is the most important factor for me since I'll be spending a lot of time on campus.

  • How important is weight and thinness to you?

Weight and thinness is not very important. I prefer a heavier build. I like something that feels solid. With that said, if the laptop you have in mind happens to be a thin-and-light, that is fine too.

  • Which OS do you require? Windows, Mac, Chrome OS, Linux.

Windows 10

  • Do you have a preferred screen size? If indifferent, put N/A.

At least a 14 inch, but I'd prefer a 15.6 inch

  • Are you doing any CAD/video editing/photo editing/gaming? List which programs/games you desire to run.

I don't game or edit. This laptop will primarily be used for word processing via Microsoft Word, and watching YouTube videos.

  • If you're gaming, do you have certain games you want to play? At what settings and FPS do you want?

N/A I won't be gaming on this laptop.

  • Any specific requirements such as good keyboard, reliable build quality, touch-screen, finger-print reader, optical drive or good input devices (keyboard/touchpad)?

Reliable build quality and battery life are what I value most.

  • Leave any finishing thoughts here that you may feel are necessary and beneficial to the discussion.

While I won't be using this laptop for anything too intensive, I wouldn't mind some overkill in terms of performance, if the budget permits. However, my main concerns are battery life and build quality.

submitted by /u/SuitPuppy
[link] [comments]

In modern PBR pipeline, how would you handle project texture organization for general environment assets and why?

Learn Programming - 9 hours 51 min ago

Sorry if this isn't the place, but a friend of mine is learning unreal engine 4 and had this question come up on a test. Could someone explain and/or answer this?

submitted by /u/SoSoSpartan
[link] [comments]

Searching for iOS 12 cookbook

iOS Programming - Thu, 01/17/2019 - 23:58

A couple of years ago I had bookmarked a website, which was basically a collection of snippets for things like reading contacts from the address book, creating calendar events, taking a picture and so forth. It was a huge help because it saved me hours of googling how to achieve specific things. I’m wondering if there is something similar for iOS 12?

submitted by /u/linusan
[link] [comments]

Github/Hosting alternatives

Learn Programming - Thu, 01/17/2019 - 23:58


I have been coding a few programs for a portfolio. But I am under the impression that anything posted to Github is shared with a community or usable in other peoples' projects.

Basically, I am just looking for a free place to host my code, applets (Mac and Windows executables), etc. Does anyone have any good suggestions? I've never done this before. I don't mind other people looking at the code, but I'd rather it not be open-source or reusable without consent.

Thanks and sorry if this is the wrong Subreddit to post in.

submitted by /u/tmogo
[link] [comments]

Swiss watchmaker's latest jab at the Apple Watch has no hands

Engadget - Thu, 01/17/2019 - 23:50
Swiss watchmaker H. Moser &amp; Cie is no stranger to taking digs at the Apple Watch. Its latest form of social commentary, however, is rather unique. The company has unveiled the Swiss Alp Watch Concept Black, a mechanical watch that once more riffs...

When do you think we'll reach the smartphone plateau?

Android - Thu, 01/17/2019 - 23:49

I remember the days whenever there's a new phone, I would be always on the fence on buying it because it has something new or different to offer from what I currently had.

Now, phones are reaching a point where they almost look the same and offer the same sets of features with unnoticeable performance bumps.

For me, it's starting to feel that the Golden Age of smartphones were from 2012-2016.

What do you think will be next?

submitted by /u/VobraX
[link] [comments]

Arranging objects in a matrix based on rules about their neighbors

Learn Programming - Thu, 01/17/2019 - 23:48

I have a 2D grid of X by Y dimensions that I want to fill with some number of objects that fit into 4 classes (A,B,C,U). I also have a set of rules about how they can be arranged (i.e. B's can't go next to C's. C's can only be next to one U, etc.). Conceptually, how do I go about writing a program that will fill in this grid if given a certain number of objects? I think I'm hung up in part because I'm not even sure of the language to use to look up this type of problem.

For what it's worth, the end goal would be to define a "Current" version of the grid and then input some change in the # of objects (broken down by class) and have it output a filled in grid that's as similar to the "current" version as possible

submitted by /u/hopefulnuke
[link] [comments]

JAVA: how to input text from keyboard

Learn Programming - Thu, 01/17/2019 - 23:38


How do I input data from my keyboard to answer a question?

System.out.print("What is your favorite color?")

I do not know how to take input data from the keyboard because our teacher wanted us to get used to using Stack Overflow and other ways of learning. All the information I see is about Scanner/ import Scanner = new Scanner, however, I cannot get any of this to work

Thank you

submitted by /u/squicboy
[link] [comments]

Warping an image without OpenGL

iOS Programming - Thu, 01/17/2019 - 23:28

Is it possible to warp an image with touch on uiImage, kinda like photoshop and facetune without having to learn OpenGL ? I find OpenGL very complicated

submitted by /u/ewelumokeke
[link] [comments]

Cannot read property '1' of 'null'?

Learn Programming - Thu, 01/17/2019 - 23:24

The goal is to style the children elements of the 'section' container that the 'li' elements are in. But the error message I'm getting is: "Cannot read property '1' of 'null'.

What am I missing in my JS code?


var section = document.querySelector('section'); var paragraphs = section.children; for (let i = 0; i < paragraphs.length; i += 1) {'blue'[i]); }


<!DOCTYPE html> <html> <head> <title>Child Traversal</title> </head> <body> <section> <p>This is the first paragraph</p> <p>This is a slightly longer, second paragraph</p> <p>Shorter, last paragraph</p> </section> <footer> <p>&copy; 2019</p> </footer> <script src="app.js"></script> </body> </html>

submitted by /u/NotARestaurantLackey
[link] [comments]

Recursion practice problem "Drill, Baby, Drill!" help

Learn Programming - Thu, 01/17/2019 - 22:59

I'm trying to improve with solving recursion problems. I found this problem set online and am not sure how to continue with Problem 3 (Drill, Baby, Drill!). The class the problem set is from uses C++, but I'm more comfortable with Python.

Here's my set up so far (very little done with the actual problem solving part):

import math import collections drillSites = [(0,0), (6,0), (3,3), (0,6), (6,6)] def get_distance(tup1, tup2): x = tup1[0] - tup2[0] y = tup1[1] - tup2[1] dist = float(math.sqrt(x**2 + y**2)) return dist def list_distance(lst): distance = 0 for i in range(0, len(lst)-1): distance += get_distance(lst[i], lst[i+1]) # add distance between last point and first point distance += get_distance(lst[0], lst[-1]) return distance def bestDrillRouteFor(points_list, optimal_list): if len(points) == 0: return optimal_list else: for i in range(0, len(points_list)): chosen_point = points_list[i] # distance for if A is picked points_list = points_list.pop(i) optimal_list.append(chosen_point) dist1 = list_distance(bestDrillRoutesFor(points_list, optimal_list)) # distance for if A is not picked optimal_list.pop() points_list.insert(i, chosen_point) dist2 = list_distance(bestDrillRoutesFor(points_list, optimal_list)) # return shortest of the two return min(dist1, dist2)

So my plan is to go through all the permutations of the `drill_sites` points and then get the `list_distance` of them. I am hoping to return the list of the shortest distance. This function is clearly not right as right now I'm just returning a numeric value instead of a list in the recursive case. But is this permutation idea the right line of thinking at all? Can anyone please provide some direction?

submitted by /u/abasabada
[link] [comments]

External GPU Suggestions

I'm looking for some insight from those who've had experience running an External GPU on a laptop. From what I've seen price wise, it'll cost a few hundred at least. But it's cheaper than a new desktop build. So I'd like some opinions on whether or not it would be worth it.

I already have a decent laptop. However, it's about 5 years old, but still has decent hardware. I also already happen to have a MSI GeForce GTX 970 graphics card.

I have never been much of a PC gamer, but I'd like to use this setup and start transitioning over from console. I'll be running Sea of Thieves and PUBG initially on the PC. PUBG is pretty demanding.

Would it be worth the extra expense for the enclosure and do you think my current laptop would be a decent primary gaming system at this point?

If so, does anyone have any experience with external GPUs and recommend a good enclosure for the graphics card & laptop that I already own?

Or would I be better off putting that money into a new build all-together?

Laptop: MSI GE70 2PE Apache Pro

Processor: i7-2710HQ

Graphics Card: NVIDIA GeForce GTX 860M

Ram: 12GB

Hard Drive: Crucial M500 240GB + HGST 1TB

OS: Windows 10

submitted by /u/PaulWall2269
[link] [comments]