• Breaking News

    Monday, November 5, 2018

    Is it better to program a little bit each day or a lot in one sitting? Ask Programming

    Is it better to program a little bit each day or a lot in one sitting? Ask Programming


    Is it better to program a little bit each day or a lot in one sitting?

    Posted: 05 Nov 2018 07:05 PM PST

    I was working on a side project and haven't had much time to dedicate to it after starting my new job.

    There's the old saying that practicing something a little bit every day is better than doing it once a week. But I'm curious if this applies to working on a project.

    I'd also love to hear anyone's experience in making time to consistently work on side projects

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

    [Python] Struggling with Global Variable in Nested Function

    Posted: 05 Nov 2018 06:43 PM PST

    I'm having a bit of trouble determining why I'm getting a syntax error using a variable defined within a function and updating that same variable with a nested function.

    Link: https://pastebin.com/vyubhd7z

    The error occurs on line 6:

    NameError: name 'x' is not defined

    I can define 'x' to be outside of main() to get it working but my professor has asked that I keep all my variables and functions within my main() function.

    I'm just not sure why my code doesn't work but example 5 on this website does: https://www.programiz.com/python-programming/global-keyword#global-nested-function

    Any and all help is much appreciated :)

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

    Why is query #2 more efficient than query #1? (basic SQL)

    Posted: 05 Nov 2018 11:26 AM PST

    Hey guys! I am looking at two basic SQL queries and trying to understand why the second one is said to be more efficient than the first. In both cases, we are looking at a database for an online retailer and trying to extract all information about customers who purchased something with overnight shipping:

    1. SELECT * FROM Customers WHERE OrderNum IN (SELECT OrderNum from Orders where ShipType='Overnight')
    2. SELECT Customers.* FROM Customers JOIN Orders ON Customers.OrderNum=Orders.OrderNum WHERE ShipType='Overnight'

    Any help would be much appreciated!

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

    Uploading files to google drive through web form

    Posted: 05 Nov 2018 09:53 PM PST

    [C#] Accessing a derived class' method from a List<ParentType>, but the parent class doesn't have it.

    Posted: 05 Nov 2018 09:28 PM PST

    So let's say i have a List of "Animal" objects(List<Animal>animalList... ) . In that list are a bunch of different animals that inherit from the abstract Animal class, like bird, dog, fish. HOWEVER: Let's say the bird class must implement an interface called Moveable() with a method called Move(). How come I am not allowed to do: "animalList[0].Move();"(assuming index 0 is the location of my bird)? Visual Studio is telling me: "Animal does not contain a definition for "Move" and no accessible extention method "Move" accepting a first argument type "Animal" could be found(are you missing a using directive or an assembly reference?" I do not want my Animal class to have the Move method. Please help.

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

    How much time do you usually put into writing tests?

    Posted: 05 Nov 2018 06:53 AM PST

    Hi /r/AskProgramming

    I am curious how much time do you usually spend on writing tests (and docs) such that all the changes are covered?

    1:1? One hour of feature development gets roughly one hour of tests?

    1:2? One hour of feature development gets roughly two hours of tests?

    How would you estimate the testing part of SDLC?

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

    Identifying Barcode Scanners

    Posted: 05 Nov 2018 06:28 PM PST

    Hello coding gurus! I am currently trying to tackle a project where I am tracking the progress of manufacturing a product through a shop using barcodes. The process involves a QC checkpoint where the inspector signs off on the product using a scanner. Assuming I have 2 or more barcode scanners(each unique to an inspector), what would be a good way to go about assigning unique identifiers to know which inspector signed off on the product without changing the barcode? Any help would be appreciated!

    submitted by /u/1eyewonder
    [link] [comments]

    C++ object not calling virtual function

    Posted: 05 Nov 2018 06:01 PM PST

    I can't possibly put all the code but the problem I'm having really is this. I have a class Object that has a child, DerivedObject. Both have a virtual method "declare" which just returns a string with either "derivedobject" or "object". When I call the declare method on o it prints "object" instead of "derivedobject".

    int main(){

    Object *o = new DerivedObject();

    o->test(*o);

    }

    In Object.cc:

    void test(const Object o){

    cout << o.declare();

    }

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

    [Java] I have to write a for loop but cannot use numerals in my code, only variables of the type Strings, and don't know how.

    Posted: 05 Nov 2018 11:48 AM PST

    I tried using this:

    for(String someString= ""; someString.length() < someOtherString.length(); someString.concat("-")) { // code } 

    but it didn't work. It just kept looping forever.

    If someone could give me some advice, I'd be most grateful. Thank you.

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

    [Java] Question about reading lines of text from a file in Android Studio

    Posted: 05 Nov 2018 05:10 PM PST

    Hello! Apologies in advance, I don't have access to my code right now. I'll describe it as best as I can.

    My program writes data into a file and separates each new word with a ",". Example, 12345678,name,job,height

    Then it makes a new line for the next round of entries. (This is in an app)

    I am displaying each word in an individual TextView. My while loop checks if there is a line, then saves each individual word in an array. It differentiates words by the ",". Now, If I was trying to make a button that would read the next line, updating the TextViews to contain the words from the next line, how would I go about this? I also have to make a button that reads the previous line. Sorry that the question is very vague, I just don't know how to force my program to read a new line, then be able to read the previous line.

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

    How do I flip the master/slave a.k.a. client/server relationship?

    Posted: 05 Nov 2018 10:55 AM PST

    I need some help with software architecture / design pattern:

    On computer X I have an algorithm A (which I cannot change), to which I supply a function f() at the start. Under normal circumstances A calls function f() repeatedly to compute some value, then A does some thinking, and then calls f() again with different parameters. Rinse. Repeat.

    But now I have a situation where f() must be calculated by a remote machine Y.

    Unfortunately I cannot do a remote function call into machine Y. What I can do is write some function g() to run in a loop on Y, and g() will contact computer X and ask "what are the parameters of f() you want me compute next?".

    I'm looking for a design pattern, preferably with some examples in Python, which implements the reversal from X as the caller and Y the responder, to Y being the caller and X the responder (and without changing algorithm A on X).

    I'm guessing the solution will involve some "daemon", which runs in the background on computer X and manages the calls, waits, responses, etc. But I don't want to reinvent the wheel. I assume there is a textbook solution I'm simply now aware of.

    Thanks for your help

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

    My computer doesn't support Visual Studio, what other alternative IDE could I use to work with c++ (that has c++17 standard) ?

    Posted: 05 Nov 2018 09:18 AM PST

    Is automated textbook comparison feasible?

    Posted: 05 Nov 2018 02:31 PM PST

    How complex would an operation be that compares PDFs for percent similarities? Application would be evaluating word count changes, ie; textbook A, 5th ed. vs textbook A, 6th ed.

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

    What Is The Best Gift/Thing You Have That You Didn't Know You Needed?

    Posted: 05 Nov 2018 10:43 AM PST

    Girlfriend recently got her first software engineering job. Currently online looking for Christmas presents to make her life easier but can't find anything good. What should I get her?

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

    Books for learning data structures/algorithms

    Posted: 05 Nov 2018 02:28 PM PST

    I'm looking for some good descriptive books for learning data structures/searching and sorting algorithms. Preferably in java or python by anything at all is appreciated. Quicker reads and longer descriptive books would both be great. Thank you

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

    "Roll 5 dice in sequence until it rolls the same number 5 times in a row - count the number of times the dices had to be rolled to get this to happen"

    Posted: 05 Nov 2018 12:11 PM PST

    edit: forgot to place it in the tittle but this is using C. like most of you probably already know by looking at it

    Hi guys I'm back. im a bit stuck on this one exercise i've gotten from my teacher. i wont die if this doesnt get done and i could skip to the next one as they arent graded but i wanna know how you would fix this.

    Some friends suggested using arrays (i dont even know what those are yet) dont know if that would be possible here. I dont think im supposed to use arrays seeing as i've only studied if/else, switch or for/while/do ... while. as of today in class.

    i've gotten some ideas that havent panned out that i can share. would anyone mind letting me know how you'd go about doing it. dont necessarily have to include the code, just some hints would be nice

    main (){ int dice=0,roll=0; srand(time(0)); do{ for(roll=0;roll<5;roll++){ int dice=rand() %6 +1; printf("%d",dice); } putchar('\t'); }while(1); //this is a place holder } 
    1. One thing i though of was to count the rolls with integres? roll1,2,3,4,5 and then put this inside the while(roll1!=roll2!=roll3!=roll4!=roll5) this way it would keep rolling until all are the same, i just dont know how i'd save the rolls.

    small edit: i havent though about that last part of counting the number of times it had to be done until it happened. but im not to afraid of that one, seems like it would be simple enough.

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

    [Java] How can I make it so that "*" is read as a command line argument?

    Posted: 05 Nov 2018 12:03 PM PST

    We have to do a thing for school where our program is supposed to read cmd arguments and do things depending on which operator it gets.

    +, -, /, and % all work, but for some reason * doesn't. I'd be grateful if someone could explain why, and how to work around this.

    To be clear, in our instructions it specifically says that the program is supposed to take * as and argument. Not "" or '', just plain *.

    edit: I tried escaping it like "", ''; *. But when I then compare it to "*" in the code I still get false.

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

    Just inherited 300+ undocumented scripts... Need guidance on inserting a 'documentation block' in each one.

    Posted: 05 Nov 2018 10:30 AM PST

    $subject;

    So far, I've added a few items to the 'documentation block'.

    Author & Ownership: Names of programmer / maintainer / manager / title / department. Customer: Name of person / department who is the primary beneficiary of what the code does. Requisites: Scripts / files / modules the script relies on. Required By: The names of any scripts that call this script. Wiki Link: URL to wiki articles referring to this script

    Can you think of any other information I should be collecting as internal documentation to the people who come after me when I rage-quit this job? :)

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

    Is there any hack to find incorrect tabs and spaces in sublime text for python codes?

    Posted: 05 Nov 2018 10:09 AM PST

    I've often been struck many times with the incorrect syntax error in sublime editor. Is there a way or hack or any tip that you guys have used to get through this?

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

    When would you use pointers vs references.

    Posted: 05 Nov 2018 04:05 AM PST

    Hello! I'm learning C++ at the moment and have just come across pointers. It seems to me like they are very similar to references, apart from being able to change what variable they point to (whilst refences cannot change what variable they reference).

    My question is, when would you want to use a pointer instead of using a reference (or potentially several references)? In my book it says to stick to references when possible because they have "a cleaner syntax and make your code easier to read", however the syntax seems to be fairly similar for pointers and references.

    Many thanks!

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

    Curious how 'modern?' DOS programs are used by businesses with multiple branches?

    Posted: 05 Nov 2018 06:10 AM PST

    I've seen some computer screens at Pizza joints where it clearly shows a DOS window with F1-F12 buttons at the bottom. It wasn't point of sale but something else.

    Also, I've been to a large electronics store and upon asking them where in which branch I could find an item, the dude started working on a DOS window that clearly was connected to the internet (some lag was noticeable when he clicked search) and was able to tell which branch of theirs had the item. Finally, the dude printed a screenshot. From what I can tell from the size of screen on the printed paper, it is 640x480.

    I'm curious, how are they doing it? Could it just be a modern app developed in Java/.NET and just have looked like a DOS window at full screen?

    Or is there really a modern DOS programming happening in 2018?

    The features I could tell it included:

    1. Stock management on all branches.

    2. Lookup service requests.

    3. Place an "order" for an item.

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

    Embed a Google Translate box/widget into website?

    Posted: 05 Nov 2018 05:43 AM PST

    I have searched online on how to embed google translate into my webpage but all I get is tutorials on how to translate my web page using google translate. I want a sort of box/widget where the user can directly use google translate within my website. Is this possible?

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

    Is there a course/book/paper that would help a self-taught dev understand Computer Science?

    Posted: 05 Nov 2018 01:05 AM PST

    I'm a self-taught developer (.NET stack) and I recently had a job interview where the interviewer basically said, "you're clearly a self-taught dev, and although I can see you're clearly skilled up, because you don't know the right buzz words you're going to get overlooked". We talked for about 90 minutes and he was very helpful, and I came out thinking I need to fix this issue.

    Is there a course I could do (I don't mind paying, but I do have a full-time job to fit it around) or a really good book, or a paper I could read to fill in the gaps in my skillset/CV/brain?

    I've considered doing a full SC course with the OU, but I thought that might be overkill.

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

    When reddit bots assign a percentage to something, how is that calculated?

    Posted: 05 Nov 2018 06:19 AM PST

    So, I've seen a bot that says something like "I'm X% certain that this user is a bot". I've seen another bot that says "It sounds like you're looking for advice on job hunting and I'm X% sure of this."

    How does X typically get calculated? I'm not sure if this is the right place to post this question or not.

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

    No comments:

    Post a Comment