• Breaking News

    Sunday, April 29, 2018

    [Python] How do I begin making actual programs? learn programming

    [Python] How do I begin making actual programs? learn programming


    [Python] How do I begin making actual programs?

    Posted: 28 Apr 2018 05:43 PM PDT

    This seems like a silly question, but I haven't had a lot of success searching for answers online. At least not ones that I understand very well, so I'm hoping some of you veterans can point me in the right directions.

    Anyway, I've been learning very basic, entry-level stuff about Python from codecademy and other practice websites. I'm nearing the point of completion in many of those, though, and I want to move on to creating "actual" programs.

    I know it's very unrealistic to expect to make anything advanced for a while yet, but I'd like to begin making useless programs on my desktop for more practice and I don't really know where to start.

    An example "useless" (useful, but already existing) program I might want to make would be one for unit conversion. Something with a GUI with two bars and two drop-down menus as well as some kind of silly "J's Unit Converter!" graphic at the top. One bar would be an entry point for your independent variable, the two drop down menus would let you select the units to convert between, and then after pressing a "Run" button it would fill the second bar with the converted value.

    Is that an unrealistic goal coming straight out of codecademy style learning? If not, how might I begin creating a program w/ GUI like that that I'll be able to run from my desktop? I only have the faintest idea how to create scripts that can stored and then run in the command prompt. Creating an executable file would be entirely new territory for me.

    Thank you in advance for your help!

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

    Any websites to interactively learn assembly?

    Posted: 28 Apr 2018 08:23 PM PDT

    Hello, I'm learning x86-64 assembly (linux), and was wondering if there was any interactive websites to help me in the process? Or any good resources in general? To add to reading the class assigned text book of course.

    TIA

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

    How can I introduce my 6th grader son to programming.

    Posted: 28 Apr 2018 05:01 AM PDT

    These are summer vacations in India and I want to introduce my 6th grader son to programming. Can someone please point me to some online resources.

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

    What's the largest project you wrote by yourself?

    Posted: 28 Apr 2018 08:34 PM PDT

    What's the largest project you wrote by yourself? How many lines was it?, did you make use of standard libraries? external libraries? and how long did it take?

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

    I got a Kindle Unlimited account. Recommendations for learning?

    Posted: 28 Apr 2018 09:15 PM PDT

    I am trying to learn python and general cs. Any recommendations on which books I should read first?

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

    Codewars - having trouble with most of the 6kyu questions - am I just bad at problem solving?

    Posted: 28 Apr 2018 11:46 AM PDT

    So I'm a year into school and I started doing a bunch of questions on codewars to work on my problem solving skills. I got through all the 7kyu's just fine but more than half o the 6kyu's I struggle with either

    1) understanding the problem or

    2) implementing the solution in code

    Is this a sign that I may not be fit for CS?

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

    How much commenting is too much

    Posted: 28 Apr 2018 09:10 PM PDT

    Jokes aside, what is and isn't important to comment? I know that there are different standards for different languages, and even disagreement within that language, but what needs to be commented? Going with that, how much knowledge should I assume the reader to have? I feel like writing comments for someone who is just using your code would be very different than someone trying to understand the logic behind it.

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

    Why is my exe needlessly big?

    Posted: 28 Apr 2018 10:15 PM PDT

    Here's my code

    #include <stdio.h> int main(int argc, char **argv){ printf("Hello %d\n", 3); return 0; } 

    Then I build it like this (using clang in the git bash shell on windows)

    clang -O3 test.c && ./a.exe Hello 3

    It's 110kb. Now copy/paste sqlite.c into it (which is >200K lines). Recompile. It's now >1mb binary despite using the exact same code to execute the app. Why? Is there an option I can use to ignore functions that aren't used? Is there some magic way I can use my exe as a dll? I don't understand why its 1+mb

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

    Any resources to brush up applying OOP concepts with System Design?

    Posted: 28 Apr 2018 09:11 PM PDT

    I'm on a job hunt as a fresh graduate. I have done 2-3 big projects, but non of them used OOP. We used basic PHP for one of them and the one which I'm doing now, I'm using Python 3 without OOP concepts. I've been in 5 interviews and in 3 of them, I was doing great until they asked OOP questions / System Design. I was confused and then it went badly.

    The project which I'm doing now is, Book Digitization system. When User input scanned copies to the system, it automatically identifies and separates the paragraphs, then it recognizes the words / letters separately, then it checks the spelling mistakes (mistakenly identified words using OCR ) and corrects then, then it summarizes the book by paragraph by paragraph and stored in a database. We are doing this in Python and with just functions (functional programming) without any OOP involved.

    Yesterday I had a interview and they asked me to present the above project with Object Oriented Concepts. I know the concepts. But I find it hard to apply them with System Design. So anyone can help me with some resources to brush up my OOP to apply into system design ? And if anyone can help me to present the above project in OOP concepts, I'd be thankful.

    Any help would be much appreciated. Thanks :)

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

    Question for people who are trying to learn functional programming (x-post from functionalprogramming)

    Posted: 28 Apr 2018 05:18 PM PDT

    Hi,

    as the title says, I'm interested in what others are doing to learn functional programming.

    For instance:

    • what's your biggest challenge in learning FP?
    • why did you decide to learn FP?
    • how much time and money have you invested in it so far?

    Thanks!

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

    How to learn and understand recursion properly?

    Posted: 28 Apr 2018 08:56 PM PDT

    I have difficulty to do recursion in my mind, specially a recursive function that creates tree like call stack structure( e.g. recursive Fibonacci sequence), I also can't understand and distinguish between which functions are recursive and which functions are not if it's given to you in pure mathematical form. Please guide me

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

    How to change button icon image when mouse hovers over the button? (PyQt4)

    Posted: 28 Apr 2018 06:11 PM PDT

     self.btn = QPushButton(self) self.btn.clicked.connect(self.close_application) self.btn.setIcon(QIcon('chem.png')) self.btn.setIconSize(QSize(500, 150)) self.btn.resize(500, 150) self.btn.move(250, 50) def eventFilter(self, object, event): if(event.type() == QEvent.MouseMove): self.btn.setIcon(QIcon('chemClick.png')) return False 

    This changes it on click and not hover, I'm also planning to do this for 4 other buttons in the same window. What do I add?

    I have a second image called chemClick.png that it would change to on hover. Then change back to chem.png when mouse leaves.

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

    Are companies like Launchcode, Revature, and Aston Technologies at all worth it for learning Web Development?

    Posted: 28 Apr 2018 10:03 AM PDT

    I've noticed a growing number of companies popping up that offer to train people for web development with various business models. I've heard a lot of people say they are scams. Are they scams?

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

    Udemy course prices ??

    Posted: 28 Apr 2018 11:27 AM PDT

    Only talking about 1 course.

    Login to Udemy and search for course.

    Price is 20$.

    Logout and check on Safari price is 15$.

    Check logged out with chrome, price is 12$.

    Click buy => already have account => udemy says I am not eligible for discount. Price goes back to 20$.

    Check google why this happens, 5 minutes later course price is 10$ on my logged in safari account.

    4 different prices in 5 minutes, wtf?

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

    What next? How do I start coding with Ruby (on Rails)?

    Posted: 28 Apr 2018 11:52 PM PDT

    I am totally new to programming and aim to spend a lot of time learning it. The past few days I have been experimenting with Java in IntelliJ, and I also have other text editors like Notepad++, Sublime Text, and Visual Studio Code.

    But, for my goals, I think Ruby would be a better option as a beginner. However, it's installation and configuration process seems much more unusual compared to others.

    So, how can I start coding and develop a test project, specifically using Ruby on Rails (or just Ruby code)?

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

    I need help with my computer science homework pretty badly.

    Posted: 28 Apr 2018 11:33 PM PDT

    I do not get this and I am running out of time. Can someone help me with this problem? I really do not get it and have no clue what to do with the JQuery code. Thank you so much, I am stressing a lot right now.

    Use HTML and JQuery (CSS optional) to create a simple form with three number inputs (input A, B, and C), and a button:

    All jQuery is executable when document is ready to be manipulated Users can enter numbers in the input A and B Clicking the button adds the two values in input A and B and updates the value of C with the sum Hovering over input C empties ALL inputs MUST use JQuery library to code functionality.

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

    Writing code in OOPS

    Posted: 28 Apr 2018 11:29 PM PDT

    I am new to OOPS but I do know some of its concepts. Even though I write programs but I couldn't quite understand how to convert those into classes and OOPS

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

    (Python) Stuck on banking system project

    Posted: 28 Apr 2018 02:43 PM PDT

    I'm taking a course in python right now and I'm having a lot of trouble making progress on our final project. I never got a good foundation in the class so this code is pretty beyond me. Below I'm copying the project description as well as my code. I had a friend helping me before but I still don't understand the code he gave me and I couldn't get it working so it's just commented out. Right now I'm trying to store all of the "new user"" information as an object, and store that in the class so I have a database I can call on. Currently my code doesn't seem to be passing through everything I want it to. I added the get_info() function to the NewAccount() function, but when I run it, it's just a loop of the get_info(). Previously I didn't have get_info() under NewAccount(), but I did have NewAccount() under get_info() in an attempt to pass it through, but it never seemed to go beyond get_info(). So any help with that would be great, as well as ideas for the features I haven't gotten to yet, or explaining the commented out code to a beginner.

    Final Project – A GUI for a Banking System 

    This banking system allows a client/customer to create a new account, which allows for deposits and withdrawals. It will also maintain loan transaction and paying loan installments. A good system should also have searching capabilities. Due: May 3, 2018

    Features: Open Account - User to Create A New Account For Customer
    Deposit Amount - Customers can deposit a specific amount in his or her accounts
    Withdraw Amount - Customers can withdrawal a specific amount from his or her accounts
    Display All Account - Displays all account information
    Display Transaction - Displays transaction information by account no, by date and all transactions of all accounts
    Delete Account - Closes account of a specific customer
    Loan - Maintains all loan transactions. Also, maintain installments
    Transfer Amount - Provide unity for transferring amount from one account to another account
    Validations - System generate account number and loan id automatically
    -User cannot enter number in name field
    -User cannot enter character for cell number
    -User cannot enter less or more than 10 digits in cell number
    -User cannot enter character in numeric field
    -User cannot enter invalid choice and invalid date into the system

    cellnumber = 0 name = "zero" balance = 0 account = 100000 accList = [] class Account: transactions = [] class Customer: def __init__(self, name, cellnumber, balance): self.name = name self.accountnum = account self.cellnumber = cellnumber self.balance = balance def withdraw(self, take): self.balance = self.balance - take def deposit(self, add): self.balance = self.balance + add def addTransaction(self, trans): self.transactions.append(trans) class Transaction: def __init__(self, accountnum2, action, amount): self.accountnum2 = accountnum2 self.action = action self.amount = amount def NewAccount(name, cellnumber, balance): get_info() global account user = Customer("name", 1115551234, 600) accList.append(user) account = account + 1 def delete_account(): print("We are keeping all your money, goodbye.") #def Transfer(accreceive, accgive, money): #for item in accList: #for otherItem in accList: #if((item.accountnum == accreceive) and (otherItem.accountnum == accgive)): #item.withdraw(money) #otherItem.deposit(money) #trans1 = Transaction(item.accountnum, "withdrawal", money) #trans2 = Transaction(otherItem.accountnum, "deposit", money) #item.transactions.append(trans1) #otherItem.transcations.append(trans2) def get_info(): get_name() get_cellnumber() get_balance() NewAccount(name, cellnumber, balance) def get_name(): name = input("Enter your first and last name").lower() if num_check(name) == True: print("Invalid Input") get_name() name.replace(" ","") def get_cellnumber(): try: cellnumber = int(input("Enter your phone number (10-digits, no spaces or dashes)")) except ValueError: print("Invalid Input") get_cellnumber() cellnumber = str(cellnumber) if len(cellnumber) != 10: print("Invalid Input") get_cellnumber() def get_balance(): try: balance = float(input("How much would you like to deposit to open your account?")) except ValueError: print("Invalid Input") get_balance() def num_check(s): return any(i.isdigit() for i in s) #def main(): #NewAccount("name", 1001, 600) #print(str(accList[0].balance) + ' ' + str(accList[1].balance)) #Transfer(100000, 100001, 50) #print(str(accList[0].balance) + ' ' + str(accList[1].balance)) #main() NewAccount("name", cellnumber, balance) 
    submitted by /u/1abby6
    [link] [comments]

    I am not allowed to use the acronym CRUD at work, what is a good alternative?

    Posted: 28 Apr 2018 11:11 PM PDT

    TLDR; But what is an alternative word for CRUD (aka create, read, update, delete), because i cannot name anything.

    I am completely and utterly dumbfounded by this, and i want to smash my head against a brick wall at the sheer insanity of it. We use this constantly in code, and even in conversations/comments/etc, e.g. something.crud.js or crud.py etc.

    Recently we had an audit after someone made a comment to HR about finding a fuck in our legacy codebase. In response to this HR hired a third party company to audit everything, and produce an actionable list of code with naughty words (along with a lot of other headaches). In this several thousand page document, every usage of crud in our codebases was highlighted.

    UnfortunatelyCRUD is a naughty word, and after finding out from that highly informative document it is slang for 'poop'. Thus even after fighting for several weeks with people about the fact that CRUD is a super common CS term, i have given up. (yes i am venting).

    EDIT Sorry i forgot to add a list of words that are no for some various reason.

    • REST (causes some IDE's intellisense to go stupid, due to there being namespaces of rest in places)
    • DAO (Conflict)
    • <anything>Access<anything> (Conflict)
    submitted by /u/SonOfSpades
    [link] [comments]

    [Resource] A tutorial series for creating a simple rest API using Node.js

    Posted: 28 Apr 2018 07:14 PM PDT

    Here is a good series that for creating a node.js rest API using MySQL. https://www.youtube.com/watch?v=fqQKugZ7wA4

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

    Given an array of geolocations, how would you find the geolocation closest to user? Thinking about scale as well

    Posted: 28 Apr 2018 10:24 PM PDT

    So I have a database of geolocations, where a geolocation is an object with the property of latitude and longitude. Bob is a user and has a given latitude and longitude. Given that information I need to find the nearest user to bob. Now, I googled this and I would be able to use the "haversine formula" to do this.

    But I am thinking in terms of scale. If I have 100k geolocations, or 1 million geolocations, then making a call to a haversine function for each geolocation and then choosing the geolocation that is closest (or close enough) may not be very scalable. What should I do?

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

    (C) Why am I getting a segmentation fault (core dumped) error when I try to pass a character into the getValue function?

    Posted: 28 Apr 2018 10:18 PM PDT

    Here's the code:

     int x = 0; for(x; x < strlen(resourceIdList); x++){ char * check= ""; strcpy(check, resourceIdList[x]); char **resources= getValue("resources.txt", check, 0, 1); } 

    Here's the definition of the getValue funtion:

     char ** getValue(char * dbTable, char * searchStr, int colSearch, int colResult) 
    submitted by /u/PuppyLand95
    [link] [comments]

    [Java][InteliJ] Unable to run project after closing project and restarting computer

    Posted: 28 Apr 2018 03:57 PM PDT

    I'm sure it's some sort of configuration option but I am not very familiar with InteliJ. Basically last night I was working on a project. I could close and open InteliJ with no issue and get right back into the project.

    This morning(after a restart), I can't seem to get it to open correctly. The FileBrowser on the left side wasn't showing any folders so I read a stackoverflow post saying I should delete the .idea folder, which I did.

    Then the project couldn't run, so I restarted the program and it's back to not displaying any folders. Basically, it shows the files in the project folder but it doesn't display the .idea and src folders.

    It is a JavaFX application if that helps.

    How do I get my application opened correctly and able to run again? Thanks

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

    [Python/Django] How to receive celery tasks from another module

    Posted: 28 Apr 2018 09:41 PM PDT

    I can successfully receive celery tasks from my main app - however, my system cannot receive tasks from another module. I'm on a remote Ubuntu server using supervisor for for celery.

    draft1 is my main app and post is another module (the one that I can't receive tasks from).

    draft1/init.py

    #This will make sure the app is always imported when #Django starts so that shared_task will use this app. from .celery import app as celery_app __all__ = ['celery_app'] 

    draft1/celery.py

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'draft1.settings') app = Celery("draft1", broker=CELERY_BROKER_URL, include=['post']) app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) #post is in my installed apps 

    draft1/tasks.py

    @periodic_task(run_every=timedelta(minutes=1)) def test_job(): from polls.models import Question for i in Question.objects.all(): if i.question_text == "test": i.question_text = "not_test" i.save() return HttpResponseRedirect('/') @periodic_task(name='run_scheduled_jobs', run_every=timedelta(seconds=30)) def run_scheduled_jobs(): return True 

    post/tasks.py

    @periodic_task(name='test_post', run_every=timedelta(seconds=30)) def test_post(): from .models import Post for i in Post.objects.all(): if i.entered_category == "test": i.entered_category = "not_test" i.save() return HttpResponseRedirect('/') @periodic_task(name='post_jobs', run_every=timedelta(seconds=30)) # task name found! celery will do its job def post_jobs(): # do whatever stuff you do return True 

    settings.py

    CELERYBEAT_SCHEDULE = { 'run_scheduled_jobs': { 'task': 'run_scheduled_jobs', # the same goes in the task name 'schedule': timedelta(seconds=45), }, 'test_job': { 'task': 'tasks.test_job', 'schedule': timedelta(minutes=3), }, 'post_jobs': { 'task': 'post.tasks.post_jobs', #i've also tried tasks.post_jobs 'schedule': timedelta(minutes=1), }, 'test_post': { 'task': 'post.tasks.test_post', 'schedule': timedelta(seconds=45), } } 

    Here is my command to start the worker: celery -A draft1 worker -l info

    and celery beat is started via: celery -A draft1 beat -l info --scheduler.

    The tasks from draft1/tasks.py are the only tasks I receive:

    https://i.stack.imgur.com/yCmNX.png

    Why is this?

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

    No comments:

    Post a Comment