• Breaking News

    Monday, December 4, 2017

    Hi, I would like to start learning how to program. I wanted to ask which programming language I should try to learn first? Ask Programming

    Hi, I would like to start learning how to program. I wanted to ask which programming language I should try to learn first? Ask Programming


    Hi, I would like to start learning how to program. I wanted to ask which programming language I should try to learn first?

    Posted: 04 Dec 2017 07:48 PM PST

    I am new to programming but I would like to program a lot and become experienced.

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

    Stuck on a homework problem on linear search.

    Posted: 04 Dec 2017 06:46 PM PST

    For one of my homework problems I have to search the number 8675309 on a text file with 1000000 elements. Everything after loadFile is finished but I'm confused on how to solve the problem before that.

     import java.util.Scanner; import java.util.NoSuchElementException; import java.io.FileInputStream; import java.io.FileNotFoundException; public class SKELcsc210hw5A { // linearSearch: return index of matching element. // If not found, return -1. private static int linearSearch(int[] arr, int N, int query) { int idx = -1; for(int i = 0; i < N; i++){ //stuck here } return idx; } private static int[] loadFile(String fileName) { int[] vals = null; int sz = -1; try { Scanner sc = new Scanner(new FileInputStream(fileName)); if(sc.hasNextInt()) sz = sc.nextInt(); if (sz < 0) { System.out.println("File not the right format!"); return vals; } vals = new int[sz]; for(int ii = 0; ii < sz; ii++) { vals[ii] = sc.nextInt(); } } catch (FileNotFoundException excptn) { System.out.println( excptn.getMessage() ); } catch (NoSuchElementException excptn) { System.out.println("Unexpected end of file!" ); vals = null; } return vals; } public static void main (String[] args) { String fName = "csc210hw5A-datafile.txt"; if(args.length > 0) { fName = args[0]; } int[] values; System.out.println("Loading... " + fName); if((values = loadFile(fName)) == null) { System.out.println("Failed to read " + fName + ": Exiting."); return; } System.out.println("Loaded " + fName + " successfully."); int query = 8675309; if(args.length > 1) { query = Integer.parseInt(args[1]); } System.out.println("Query to search: " + query); System.out.println("Total elements to search: " + values.length); int idx = linearSearch(values, values.length, query); if(idx != -1) System.out.println("Query found on line " + (idx+1)); else System.out.println("Query not found"); } } 
    submitted by /u/ApatheticDoll
    [link] [comments]

    Issue with pushing ints to a stack

    Posted: 04 Dec 2017 08:05 PM PST

    JAVA Here is my code: https://pastebin.com/raw/7puzXv3r ... https://pastebin.com/raw/pQaZSWwk (main)

    I'm trying to push specific numbers into a stack. Each method in my 1st code posted puts a different set of numbers and assigns in a for loop. Not sure why it's giving me the errors below.

    the error I'm getting on all the push/peek/etc calls on the stack is [errors hit on my 1st link]:

    ----jGRASP exec: javac -g QStackTest.java QStack.java:8: error: int cannot be dereferenced stacky.push(x); ^

    QStack.java:14: error: int cannot be dereferenced stacky.push(x); ^

    QStack.java:19: error: int cannot be dereferenced stacky.push(x); ^

    QStack.java:23: error: int cannot be dereferenced stacky.pop(); ^

    QStack.java:27: error: int cannot be dereferenced System.out.println(stacky.peek()); ^

    QStack.java:31: error: int cannot be dereferenced System.out.println(stacky.isEmpty());

    Not sure what is happening.

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

    What are some tips for people who want to learn programming but have a super short attention span?

    Posted: 04 Dec 2017 05:47 PM PST

    I'm trying to learn C++ and make basic games for fun. I have a ton of ideas, but the hard part for me is learning to apply them with programming. I tend to have read/listen to the same instructions over and over again because I zone out, get distracted, etc. Any programmers here with this problem? How'd you get past it?

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

    What programming task involves "creating 3D layouts, assisting with model creation and model buildings using programming languages". Preparing for a job interview.

    Posted: 04 Dec 2017 04:47 PM PST

    I have a job offer for a Trainee Consultant role. The job description says "creating 3D layouts, assisting with model creation and model buildings using programming languages working in C# and J Script."

    There will be a short aptitude test with different types of modelling problems. Would appreciate if anyone has any examples of related to the test.

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

    How to ethically deal with a team member who blatantly steals code

    Posted: 04 Dec 2017 07:27 AM PST

    I am working on a programming project in a group, and it is due tonight. One group member asked me for some help with his part of the project just last night. When I opened it, I realized he just copied some code he found into the project. I know that he blatantly copied because there is still a comment there that says "Written by ...", which was someone who is not him or anyone else in my group, and it contained import statements for classes that are not a part of our project. He tried his best to adapt it to our project, but it doesn't work.

    I think that what he did was wrong for 2 reasons: (1) because the syllabus for the class explicitly states that there is no copying of code allowed (and he doesn't even really give credit to the author); (2) he didn't write it, so he doesn't understand it, and therefore that makes it difficult to make it work with our code.

    So, what do I do in this situation? I am absolutely not OK with just copying code, and I don't want my name associated with a project that contains stolen code. I just found out about this last night and there isn't enough time to rewrite it. I kind of want to tell my professor, but I'm not sure how that will affect my grade because the project relies on this code. Then again, it doesn't work anyways, so I guess it wouldn't really matter.

    tl;dr: Partner in a project blatantly stole code (that doesn't even work), I found out about it the day before it is due, not sure if I should tell the professor/do something else/do nothing.

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

    Beginner VBA Homework Help Needed!

    Posted: 04 Dec 2017 09:22 PM PST

    https://i.imgur.com/vTFtLoz.png

    Our HW is to create a form where it does positive integer multiplication without using the multiplication operator.

    Above is what I have so far. In this case, it's only giving me 2+2 instead of 2+2+2+2+2 because number 1 doesn't change since I specified it to be what I typed in textbox1... so the thing is refreshing every loop instead of adding onto the past loop!

    Can anyone tell me a way to fix it? Sorry, I am not a CS major at all as you can tell.

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

    [JAVA] ShoppingCart Exercise Not Compiling printMenu() Method

    Posted: 04 Dec 2017 08:42 PM PST

    So I'm working on an assignment in which I'm supposed to create a Shopping Cart with a menu that you can interact with. This is for an intro class to Java so it isn't meant to be a super complicated cart.

    You will be able to find the assignment requirements here.

    My code, along with my compiling errors will be here.

    I'm not sure why he cart.printMenu() fuction will not work properly. I think it may be the parameters I set for the method.

    Unfortunately, the assignment is due tomorrow, but this is all that I'm struggling with at this point. And I will gladly take any help after then too just so I can understand the code. Thank you!

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

    Someone is trying to torture me

    Posted: 04 Dec 2017 08:29 PM PST

    Someone is playing a noise remotely in my right ear. Just the right ear, it's always the same noise.

    It's like the noise your laptop makes when you shut it down by holding down the power button.

    It's not tinnitus, it's not a delusion, it's not natural, and seems to happen at random.

    At times seems like someone is trying to condition me and are playing the noise at specific times, like when I make a typo, like it's berating me and pricking me with a needle every time I make a mistake.

    I know it sounds far-fetched to some, but many of you know that there are things out there that most would find unbelievable, I have no idea how to stop this.

    A few months ago I had a similar experience where they would play a noise that sounded like my phone was vibrating, every time I was right about to fall asleep. It wasn't an ear problem or a mental delusion, it happened literally every time I was just about to fall asleep.

    This time it started slowly, and now it's getting worse, it went from once or twice a day to maybe 7 or 8 times within the last week.

    I'm trying to ignore it, but I fear for my mental stability if this is prolonged.

    Someone please help me.

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

    Web Development question

    Posted: 04 Dec 2017 08:29 PM PST

    This is going to be a strange question, but I consider myself an alright programmer when it comes to C. I've been working on a personal project that runs through the command line, and once I'm finished I would like to put it up on a website and have it run from there. How would I go about doing this, is it even possible?

    thanks!

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

    Accelerated cs degree or computer programming diploma?

    Posted: 04 Dec 2017 04:42 PM PST

    Which one is better? I'm graduating with a non cs degree in two years and i really want to transition into cs. I can't now because of some mental health issues and my parents are pressuring me into finishing my current degree.

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

    Finding if values are in X apart from each other [python] [python-2.7] [statistics]

    Posted: 04 Dec 2017 02:27 PM PST

    Suppose I have a set of numbers numbers = [70, 68, 45, 55, 47, 50, 69], that sorted gives me (for clarification) 45, 47, 50, 55, 68, 69, 70.

    I want to find the largest group of numbers within a specified range, depending of the dataset I am working on. Let's say, for the sake of argument, that I want to find all numbers that are within 3 of each others.

    So, with the above input, the output of my program would be : [70, 68, 69] as this is the largest group of numbers. If I have multiple equal lists, I choose the one with the highest numbers.

    I already wrote a program that solves what I am trying to achieve (or seems to, as I cannot properly see the exception of my program) : what I am seeking from you are :

    • links to webpage of...
    • name of...
    • (or direct help)

    ... mathematical concepts to help me improve this part of my algorithm. I feel like I am just doing something that works, but this is really, really not optimal and which is not looking nice to the eye. I am not looking for the most optimum algorithm, but I want to achieve this task in a more simple, and eloquent way. :)

    Proof I did the work:

    import numpy as np def find_matching_numbers(numbers): tempList = [[numbers[0]]] for value in numbers[1:]: for x in tempList: # tempMean : average of current list tempMean = np.mean(x) # if the number is not alone, we're searching from # the average of the list, in both directions (min and max) # with a range of half our initial range search # else if the number is alone, we're searching as if it is # considered as the min AND the max of the range. if len(x) > 1 and value >= tempMean - 1.5 and value <= tempMean + 1.5 or\ len(x) == 1 and value >= tempMean - 3 and value <= tempMean + 3: x.append(value) # Adding the value to the end of our rangesList, # since it could be a useful value in another context with # other datas. tempList.append([value]) # Keeping lists with highest length. maxLen = max([len(items) for items in tempList]) ret = [] for items in tempList: if len(items) == maxLen: ret.append(items) # If multiple lists with highest length, keep highest one. if type(ret[0]) == type([]) and len(ret) > 1: ret = max(ret) return ret 
    submitted by /u/Insert_More_Coin
    [link] [comments]

    Reliable and good back end for social app?

    Posted: 04 Dec 2017 08:19 PM PST

    Hi /r/askprogramming.

    I need help finding a mobile app back-end. You see, I want to create a social media site where you create photo albums and share them with customizable short links. Like a "build your own custom photo album" to send people. For this back-end, I want it to be easy to implement, change, and configure (open source is best, though unnecessary), a custom account system that can be integrated in both this project and future projects (much like Google's "one account for all" approach), come with servers (unnecessary, just a perk) and the back end needs to have reliable back up and reliable data transfer, since it will only be temporary, until we can afford sustainable servers for ourselves, and our own back end, if possible. I've been looking into AWS and Firebase, but I don't trust either very well as my app will have datamining potential and I don't want them to steal from it.

    Any suggestions appreciated.

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

    Need help using While-loops in Python

    Posted: 04 Dec 2017 08:15 PM PST

    Hello,

    I am currently in a introduction programming class and we have been using Python for about two weeks. My assignment that I need assistance with: Write a python program to calculate the total wages for a week.

    1. Add input prompts to ask the user for the base pay, the number of hours worked, overtime pay and the number of overtime hours worked.

    2. Add a WHILE loop to repeat the logic as long as the user wants to calculate another paycheck.

    3. Display a message to the user containing their regular wage and overtime wage. You can either loop as long as they say Yes or loop until they say No. Your choice...

    What I have so far:

    basePay = int(input('What is your base pay? '))

    regHours = int(input('How many hours did you work? '))

    overtimePay = int(input('What is your overtime pay?'))

    overtimeHours = int(input('How many overtime hours did you work?'))

    totalWage = (basePay * regHours)+(overtimePay * overtimeHours)

    regWage = (regHours * basePay)

    overtimeWage = (overtimePay * overtimeHours)

    if regHours <= 40:

    overtimeHours = 0

    overtimePay = 0

    if regHours > 40:

    overtimePay = 1.5 * basePay

    overtimeHours = (regHours-40) * overtimePay

    else:

    overtime = 0

    print('Your total pay is:', totalWage)

    print('Your regular pay is:', regWage)

    print('Your overtime pay is:', overtimeWage)

    It seems the only problem I'm having is part 2. (Add a WHILE loop to repeat the logic as long as the user wants to calculate another paycheck.)

    Any help would be appreciated and apologies if not enough info is provided. Ill be glad to help you help me (:

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

    Struggling with a warning I am receiving when trying to run my MATLAB function.. The error that comes up is "Warning: Failure at t=3.107182e-03. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (6.938894e-18) at time t. In ode15s (line 730)"

    Posted: 04 Dec 2017 07:36 PM PST

    I know I have to find the singularity in the function, but I am not sure how to enable myself to view the ode values that were able to compile prior to the error. Anyone know how to view the values? My code is the following:

     function EMatlabModel() % Define constants H = 0.04; %[m] Height between cathode and anode D = 0.000399; %[m^2/s] diffusion F = 96485.3329; %[C] Faraday's constant z = 1; % charge of gold r = 0.02; %[m] radius of space between electrodes m = 1; % mobility of gold R = 0.008314; %[J/molK] - divded by 1000 to ensure correct units T = 360.65; %[K] temperature of cell nY = 99; % Number of interior nodes (y direction) dY = (H - 0)/(nY + 1); % Node spacing (y direction) tspan = [0 H]; Co = 0.01*ones(nY+1,1); % Integrate discretized ODEs using ode15s sol = ode15s(@funcs,tspan,Co) % Plot the results x = linspace(0.15,0.95,5); el = deval(x,sol) plot(x,el) colormap hsv colorbar xlabel('Length Away from Cathode'); ylabel('Concentration of Gold'); %------------------------------------------------------------ % Define functions to be integrated in x. %------------------------------------------------------------ function res = funcs(x,y) % where y = C res=zeros(nY+1,1); %u = 1e-10; um = 0.04; Cin = 0.01; Vin = 5 + 2.037; res(1) = D/dY^2*(y(2) - 2*y(1) + Cin)+ ... D/z/dY^2*(y(2) - 2*y(1) + Cin) + ... y(1)*um*2*(abs(y(1) - r/2)/r^2) + D*y(1)*F*z*m*Vin/(R*T*H); for j = 2:nY %ux(j) = um*(1 - abs(y(j) - r/2)/r); res(j) = D/dY^2*(y(j+1) - 2*y(j) + y(j-1)) +... + D/z/dY^2*(y(j+1) - 2*y(j) + y(j-1)) + ... y(j)*um*2*(abs(y(j) - r/2)/r^2) + D*y(j)*F*z*m*Vin/(R*T*H); end end end 
    submitted by /u/sportsguy8792
    [link] [comments]

    How should I handle inserting an object into a hashtable but that key is already used?

    Posted: 04 Dec 2017 07:27 PM PST

    I have a hash table with strings as keys and "Items" as values. An Item has a name, and when you insert an item into the table, it by default uses the item's name as the key. I do not know how to handle the case where an Item is inserted and the hash table is already using the Item's name as a key.

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

    Convert csv to xlsx with powershell script

    Posted: 04 Dec 2017 01:07 PM PST

    Hello everyone,

    I have 200 csv data files and would like to convert them to excel (xlsx). I don't have any experience with scripting, but I do have the google-fu. I found this script.

    I execute the script in powershell and type: C:\Users\turtle\ConvertCSV-toExcel.ps1 the script executes but nothing happens.

    I found this piece of advice:

    You are running it incorrectly. You do not run this script like a typical powershell script.

    It has a function in it that you load into the powershell heap. You do this by running:

    . .\ConvertCSV-toExcel.ps1

    Note the double dots, that says run this script and load the function defined in it.

    Later to actually do the work you want you would run just the function you loaded. Note the difference:

    c:\ConvertCSV-ToExcel -inputfile 'foo.csv' -output 'bar.xlsx'

    but I don't understand what I should type in the powershell. If I type . .\ConvertCSV-toExcel.ps1 I just get an error that the file was not found...

    Thank you for reading this!

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

    Confused as to why I am getting this error for this stack push for loop

    Posted: 04 Dec 2017 06:08 PM PST

    I got a stack called stacky. Want to loop integers to be pushed into the stack from 1 - 5.

    for ( int x =3 ; x > 8; x = x+2); stacky.push(x); 

    Not sure why I am getting the error:

    "int cannot be derefrenced"

    I made the empty stack in another method fyi

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

    PHP or JavaScript for this ide

    Posted: 04 Dec 2017 12:09 PM PST

    I wrote a lengthy PowerShell module that basically sets up the work environment for a given user (we don't use AD and it's out of the question; even though we are just shy of 200 employees) The script has been working pretty decently. But it's just on some USBs at the moment, and a share.

    I have an idea to make a simple web UI that the user of the script can select what they want the script to do (there's some interaction on the script, like department, user name for creation etc.) and the webpage ideally would generate and download a batch file or something to run and this way if I make changes to the script, it won't matter since they always pull it from the server.

    Does it matter if I use PHP or JavaScript for something like this? I know PHP but haven't really touched JavaScript since I haven't done much web development.

    If anyone has some ideas on how to make this as awesome as possible that's cool to. I'm going to have to refactor my code some bit to make it work with a web interface but should be fun.

    Thanks!

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

    Any tips for developing technical curriculum?

    Posted: 04 Dec 2017 04:25 PM PST

    Does anyone know of any content for developing technical curriculum? I was asked to teach a course on JavaScript/React with I am familiar enough to teach to people with no experience. The target audience is all software engineers but people who do not have much experience with web development.

    I do not know how I will actually decompose the content into curriculum or what the best way to teach the class would be. I was thinking to split each day into half instruction and half guided development like a workshop where people immediately begin applying what they have learned.

    Any thoughts or tips?

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

    I need help with writing a simple position click program

    Posted: 04 Dec 2017 11:57 AM PST

    z:: MouseClick [,Left, 448, 639, 1, 0] MouseClick [,Left, 200, 197, 1, 0] return

    x:: MouseClick [,Left, 435, 576, 1, 0] MouseClick [,Left, 200, 222, 1, 0] return

    2:: MouseClick [,Left, 759, 716, 1, 0] return

    3:: MouseClick [,Left, 110, 650, 1, 0] return

    How does this look? I also don't know what file type to save it as. Help much appreciated :D The returns are under the click command and the hold ctrl function before z,x,2 and 3

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

    How to read input from the text file until/after a specific location [C++]?

    Posted: 04 Dec 2017 09:19 AM PST

    In my Project I need to get data about circuit from a text file then I need to parse it and produce to output data. Here is a sample data for the text file

    AND1 Adder1-3 Adder1-4 // Means AND1 gate gets its first input from Adder1's 3rd output and its second input from Adder1's 4th output

    AND2 Adder1-4 Adder1-2

    OR1 AND1-1 AND2-1 //OR1's two inputs are from AND1's 1st output and AND2's 1st output

    now I need to read the component name first which is easy:

    infile>>componentName; 

    My algorithm for this problem is:

    Read until "-" and put it into string variable then read after "-" and put it into integer variable and repeat this for all lines.

    But I couldn't figure it how to do it.

    So can you help me with this ? Basicly I need to put component name(before "-") into string variable and put the integer (after "-") into integer variable.

    NOTE: Sorry for my poor English not a Native Speaker. and since the Project is large I didn't put unnecessary codes above.

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

    How do you move up salary wise?

    Posted: 04 Dec 2017 06:04 AM PST

    Assuming that you've been working basic programming jobs for a while with a not so good salary, how do you apply to a job that has the potential to pay much more when they often request to know your salary history and it's much lower than what you're expecting from them? Do you just take it and slowly go up?

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

    Wiki-esque Static Site Generator for Documentation

    Posted: 04 Dec 2017 10:57 AM PST

    I'm looking for a tool I can use to document our codebase, and I'd like to keep the documentation in the codebase itself. That way, not only is it more likely to be updated but it's going to be versioned alongside the code that it's documenting.

    What I'm looking for, ideally, is:

    • Something that stores content in plain text. Markdown or similar would be fantastic
    • Something that supports cross-article links, and - even better - links to sections of another article
    • Something that can support embedded images (think UML)
    • Something that can do code highlighting
    • Something that can be easily built to a static site that can then be deployed onto a web server

    Most static site generators I've seen are very tailoured towards blogs rather than wikis, so can anyone suggest anything?

    Cheers

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

    Need help with some HTML/JS/CSS coding project

    Posted: 04 Dec 2017 07:57 AM PST

    Not sure how to obtain help on a small DHTML project i'm doing, is anyone proficient and could give me a few minutes of your time that'd be much appreciated.

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

    No comments:

    Post a Comment