• Breaking News

    Friday, October 19, 2018

    What are some common job processes have you been able to automate at work? Ask Programming

    What are some common job processes have you been able to automate at work? Ask Programming


    What are some common job processes have you been able to automate at work?

    Posted: 19 Oct 2018 03:03 PM PDT

    Why does craigslist.org use the file structure city.craigslist.org vs craigslist.org/city?

    Posted: 19 Oct 2018 09:52 AM PDT

    sql command question.

    Posted: 19 Oct 2018 09:26 PM PDT

    I have been building a program to work with a sql database, inserting records into a table I have down. My question is how can I check a 2nd table to see if it has a record matching the entry and if not then add it.

    table a has (aid,aname,atelephone)
    table b has(bid,bname,btelephone,baddress,bdescribe)

    I am looking to insert into table b, then as it inserts it checks table a for a matching id. if no id exists for it to enter in with the information from b table.

    like aid=bid

    aname=bname

    atelephone=btelephone

    but if the id already exists in a then it just adds the record to b and moves on.

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

    C++ Stack Memory

    Posted: 19 Oct 2018 08:14 AM PDT

    Okay so I have a bit of a question. My C++ professor says that the following code doesn't compile:

    int z; z = 7; char c[z]; 

    However, I ran this code and it not only compiles, but it runs. He claims it won't compile because the compiler doesn't "know for sure" that z=7, and thus can't layout the memory before runtime.

    But why would the compiler care? Wouldn't the runtime just add on to the stack pointer however much z is? If someone could help me understand why this works that would be great.

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

    C++ | Adding a selection to my current code

    Posted: 19 Oct 2018 06:28 PM PDT

    I made a Celsius to Fahrenheit converter that works, now I want to make it an option in the code to select Fahrenheit to Celsius.

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

    How would I go about doing that? What would that term be called?

    Any help is greatly appreciated!

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

    Noise cancelling headphones ?

    Posted: 19 Oct 2018 02:35 PM PDT

    I work in programming , and sometimes you need to get on with work , listen to music and not hear anything or anyone else in the office

    What noise cancelling headphones would you recommend?

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

    Simple Guess The Number game written in C is giving me very strange results, and I don't know what to make of them.

    Posted: 19 Oct 2018 06:00 PM PDT

    My code is below.

    And if anyone knows of any good debuggers for Windows 10, feel free to link me one.

    #include <stdio.h> #include <time.h> #include <stdlib.h> #include <string.h> int main() { srand((unsigned int)time(NULL)); /* Creating random number to be guessed. */ int r = rand(), guess, tries = 0; printf("Enter any random number:"); /* User makes their guess. */ scanf("%d", &guess); while(guess != r) /* The user contines entering answers until they get it correct. { * With each failure, the number of tries they've taken is displayed. tries++; */ printf("Not quite. It has taken you %d", &tries, " Try again."); scanf("%d", &guess); } printf("You win! The correct answer was %d", r, ". And it only took you %d", &tries, "tries."); /*Message played on ending.*/ printf("Play again? Y for Yes and N for no."); char answer[1]; scanf("%1s", &answer); /* User enters their response: Y or N. */ if(strcmp(answer, "Y")) /* If the user says Yes, the program starts from the beginning. */ { main(); } return 0; /* If the user doesn't say yes, the program ends. */ } 

    The output for the variable "tries" is some number around 6 million.

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

    Does GPL version three or Apache license grant trademark rights?

    Posted: 19 Oct 2018 05:45 PM PDT

    ARM find string length

    Posted: 19 Oct 2018 10:40 AM PDT

    I am attempting to find the length of a string stored in input. My code works for strings of length 1-7. However then for strings of length 8-10 it also outputs length = 7. Then it begins to increment again. A input string of length 11 will output length 8, a input of length 12 will output length 9, etc. I am super confused and have no idea why this is happening. My TA also had no idea and i am literally in the midst of a panic attack because of this project.

    /*

    X1 will be our iterate. Iterate through the string until you find the end. Know you find the end when you hit the null terminator 0

    */

    mov x1, #0 @initialize iterator

    bl _find_length

    _find_length:

    ldr x0, =input

    ldrb w12, [x0, x1] @get input[x1] and store in w12

    cbz w12, _store @if w12 is 0 we are at end of string, branch to store function

    add x1, x1, #1 @else x1++

    cbnz w12, _find_length @loop

    br x30 @branch return to bl _find_length

    _store:

    adr x4, input_len @set x4 to address of input_len

    sub x1, x1, #1 @x1-- since we are 1 past the end of our string

    str x1, [x4] @store x1 into input_len

    br x30 @return to cbz w12, _store

    I am working on a ROC-RK3328-CC 2gb board.

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

    Multiplying one array by the reverse of another array in C

    Posted: 19 Oct 2018 04:16 PM PDT

    I'm about 8ish weeks into my first programming class, and have never posted here before so bear with me

    To clarify, the exact problem I am trying to do says this: "Write a function that finds the "inverted" product of two arrays and writes the results to a third array."

    Pseudo code was provided to help, but when I try using it, I'm going wrong somewhere. I can get to the correct answer but I don't think it's the way they're looking for. Anyway, here's the pseudo code:

    //a an array a[1..n]

    //b an array b[1..n]

    //c an array c[1..n]

    c[1] = a[1] * b[n]

    c[2] = a[2] * b[n - 1}

    ....

    c[n - 1] = a[n - 1] * b[2]

    c[n] = a[n] * b[1]

    So the before would look like this:

    a[] = {1, 2, 3, 4, 5}

    b[] = {6, 7, 8, 9, 10}

    and after the function it should be like this:

    c6[] = {10, 18, 24, 28, 30}

    If anyone is willing to help, that'd be great. Thanks

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

    How to reuse JUnit tests on implementation classes that are slightly different?

    Posted: 19 Oct 2018 02:55 PM PDT

    I'm working in Java on implementing some discrete-math algorithms that are slightly different and have different advantages and disadvantages in certain situations. I want to write unit tests for them. I've used JUnit before for basic unit testing, but this is the first time I'm working on multiple implementations of the same basic thing. Usually I write one unit test class per implementation class, and because the implementation classes are completely different, there's no overlap. But now I have overlap...

    Suppose I have this class hierarchy (my real situation is much more complicated unfortunately) for classes that take in an InputStream and decode to a list of objects:

    interface TweedleDecoder { public List<Bird> decode(InputStream is); public boolean supportsRaptors(); public boolean supportsPenguins(); } interface TweedleDecoderFactory { public TweedleDecoder create(); public boolean supportsRaptors(); public boolean supportsPenguins(); } // implementations of the factory classes not shown class TweedleDee implements TweedleDecoder{ public boolean supportsRaptors() { return true;} public boolean supportsPenguins() { return false; } /* decode implementation not shown */ } class TweedleDum implements TweedleDecoder{ public boolean supportsRaptors() { return false;} public boolean supportsPenguins() { return true; } /* decode implementation not shown */ } class MadHatter implements TweedleDecoder{ public boolean supportsRaptors() { return false;} public boolean supportsPenguins() { return false; } /* decode implementation not shown */ } class Walrus implements TweedleDecoder{ public boolean supportsRaptors() { return true;} public boolean supportsPenguins() { return true; } /* decode implementation not shown */ } 

    The encoding stream may or may not include Raptor and Penguin objects (it's possible to determine at the beginning whether they are present or not) and I'm trying to unit test all four of these implementation classes. Is there a way to write a unit test class that includes/excludes tests based on a parameter? Something like

    class TweedleDecoderTester { final private TweedleDecoderFactory factory; private TweedleDecoder decoder; TweedleDecoderTester(TweedleDecoderFactory factory) { this.factory = factory; } @Before public void setUp() { this.decoder = factory.create(); } @Test @BirdSupport(Penguin) public void testThreePenguinsDancing() { ... } @Test @BirdSupport(Penguin) public void testTwoPenguinsSwimming() { ... } @Test @BirdSupport(Penguin, Raptor) public void testEagleEatingAPenguin() { ... } @Test @BirdSupport(Raptor) public void testOspreyDiving() { ... } @Test public void testTenThousandStarlings() { ... } } 

    where all implementations would have testTenThousandStarlings executed, but for TweedleDum and MadHatter which do not support Raptor, the testEagleEatingAPenguin and testOspreyDiving tests would be skipped, and for TweedleDee and MadHatter which do not support Penguin, the testThreePenguinsSwimming, testTwoPenguinsSwimming, and testEagleEatingAPenguin tests would be skipped.

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

    How to structure nosql database

    Posted: 19 Oct 2018 07:26 AM PDT

    I'm developing an application that keeps track of rooms and their status. I'm using couchDb to store my data. I have a few years of experience developing SQL databases, but this is my first noSql database and I'm a bit confused on how I should structure my data.

    So let's say I have 50 rooms. Do I just create a document 'rooms', which contains a list of all the rooms and their data? Or should I create a document for every room seperately?

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

    How to scrape search-engine results?

    Posted: 19 Oct 2018 06:18 AM PDT

    I tried making a web-scraper that enters google searches and collects the results. Of course, it wasn't long before I got IP banned from google. I am wondering if other search engines that don't log IP info like duckduckgo are similar?

    Is there a search engine out there explicitly made for scraping? I saw something about one with PHP but I don't know PHP unfortunately. (I am using python.)

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

    I get a NullPointerException when calling a method from another class. The solution is probably right under mye nose, but I would love some fresh eyes on it.

    Posted: 19 Oct 2018 12:14 PM PDT

    Node: Let the JavaScript on a page execute on the retrieved page

    Posted: 19 Oct 2018 11:10 AM PDT

    Using the Request module, I'm making GET requests to a page. I then parse the body using Cheerio.

    I noticed that the parsed body is different from the page I'm getting in the browser. Could it be that the JavaScript on the page is not executed when I'm doing it in Node? Is there a way to fetch the JS and execute it on the retrieved body?

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

    Algorithm to minimize consecutive ones and zeros

    Posted: 19 Oct 2018 11:10 AM PDT

    I'm trying to reflect on my collegiate courses and recall an algorithm that would limit the number of consecutive ones and zeros from a bit-stream.

    For example, if my input stream is 11111, I want a guarantee the next bit is zero in the sequence.

    Does such a thing exist or am I imagining things?

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

    Can someone explain the AI memes to me?

    Posted: 19 Oct 2018 09:43 AM PDT

    What's the running joke behind AI just being a bunch of IF statements?

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

    how would i write a pseudocode for this problem

    Posted: 19 Oct 2018 09:09 AM PDT

    destination name and code transportation cost per person entry fee per person tour cost per party
    japan code: J 2500 2000 4000
    Montenegro Code: M 3700 600 5200
    Amsterdam Code: A 3000 4000 0

    The customer will book by providing the following information: customer ID, first name, last name, telephone contact, a code corresponding to the destination to which they would like to travel, the number of persons in their travel party and deposit. The system should calculate the transportation cost of the tour and the balance remaining for payment.

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

    What's the best path to learn ReactJS

    Posted: 19 Oct 2018 07:19 AM PDT

    So I'm bored and I want to learn ReactJS slowly outside of work, what is an effective approach? Good resources? Bad resources to avoid?

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

    Curses for python37?

    Posted: 19 Oct 2018 07:11 AM PDT

    I recently downloaded visual studios to try to play with python, something I made requires curses, however I get "No module found error" or something similar, when I try to get pips to search and install, it can't find a compatible version. Any reasons why?

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

    What are some recommended relatively recent books on Linux System Programming?

    Posted: 19 Oct 2018 07:03 AM PDT

    The book The Linux Programming Interface seems pretty old and I wonder if parts of the book are obsolete or not.

    I want to gain deeper knowledge about DRI3, display servers, wayland and its compositors and how they would work with Vulkan and some I/O.

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

    Issues with slopes, specifically when moving downwards

    Posted: 19 Oct 2018 06:43 AM PDT

    Hey guys, I hope someone can help me. I'm sure most of you know that if you use Unity's built in character controller, that you will run into the issue of bouncing down slopes, because gravity is applied after the horizontal movement, meaning you bounce.

    I've tried several methods of fixing this, higher gravity when on the ground (not recommended), snapping myself to the groundslope (works decently, screws up jumping), aligning the movement vector to the normal of the slope (never got this to work properly).

    I don't want a difficult implementation of this, I think the last option of aligning the movement vector would probably work best, but since I'm stuck with it I either would like help in implementing that, or would like an alternate way of achieving this.

    I'm using Unity C# scripts, if needed I can post the movement code as well, though it is quite simple

    Anyone have any ideas on how to get this to work the best way?

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

    i'm trying to make an app please help! just a few suggestions would do!

    Posted: 19 Oct 2018 03:48 AM PDT

    i'm trying to build an app with multiple transparent(to the layer below) layers containing gifs on them(or looping animations of b/w line-art ,basically i want the white space to be transparent and the black lines to be opaque) . and i want the layers to slide as you tilt the phone so that it gives the appearance of depth.parallax .(like how the app-icons on the iphone's home shift with respect to the background as you tilt it).. if you could tell me specific bits of info/advice that could be helpful here(for example i recently learnt that only png's can be transparent) i would be so grateful and maybe even make you a shrine <or whatever you're into>..!!

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

    c programming beginner

    Posted: 19 Oct 2018 02:47 AM PDT

    can someone help make a programm that proofs that the number 105 is not a prime number?

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

    No comments:

    Post a Comment