• Breaking News

    Friday, August 31, 2018

    What job interview questions were you asked on your job interview? Ask Programming

    What job interview questions were you asked on your job interview? Ask Programming


    What job interview questions were you asked on your job interview?

    Posted: 31 Aug 2018 11:14 AM PDT

    The call of the code

    Posted: 31 Aug 2018 04:41 PM PDT

    I've just woken up after a long night of coding. I feel like my brain repartitioned and for a while after waking up (30 min lying in bed) my every thought had parameters and a return type, also being like a self managing coroutine that ran itself until completion. I got stuck in a loop and was paralyzed waiting for the coroutine to finish, ready to submit the return statement. I was watching emotionless as my body and mind ran code I wasn't familiar with from some foreign unsanitized input. I found myself doing things I wouldn't normally do while stuck in this odd loop. I didn't go anywhere physically, but I just lie in my bed jumping though imaginative loops and imaginitive actions until I slowly broke out of it and regained my emotion. It didn't cause me any harm, because thankfully I had nowhere to be, but I'm worried that might happen in the future.

    Is this common? Is there a name for this? Should I be concerned?

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

    Why are languages seemingly bound to their implementation (i.e. compiled vs interpreted)?

    Posted: 31 Aug 2018 12:39 PM PDT

    What's stopping someone from say writing a compiler for the python specification that is compliant to the spec? If the specification requires the language to be interpreted/compiled why is that the case? Why would the language specification not solely focus on the grammar of the language?

    Edit: TIL you can write compilers/interpreters for interpreted/compiled languages it's just kind of a preference at times and in some cases a necessity to make a specific implementation

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

    Am I going to destroy my computer or not?

    Posted: 31 Aug 2018 09:43 PM PDT

    New C programmer here. Reading through Sams Teach Yourself C in One Hour a Day.

    On page 202 there is a section called Pointer Cautions where it says

    "The following statement declares a pointer of type int:

    int *ptr

    This pointer isn't yet initialized, so it points to a random area in memory storage...

    if you use an uninitialized pointer in an assignment statement, this is what happens:

    *ptr = 12;

    the value 12 is assigned to whatever address ptr points to... The left side of an assignment statement is the most dangerous place to use an uninitialized pointer."

    However, a mere 18 pages later the author states:

    "You might recall how to declare such a pointer

    char *message;

    This statement declares a pointer to a variable of type char named message. It doesn't point to anything now, but what if you changed the pointer declaration to read:

    char *message = "Great Caesar\'s Ghost!";

    When this statement executes, the string Great Caesar's Ghost is stored somewhere in memory, and the pointer message is initialized to point to the first character for the string."

    So why is it that the first situation can potentially destroy my operating system but the second one is standard operating procedure? And why didn't the authors have the foresight to see that the reader might be super confused by this seeming contradiction???

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

    3D engines (open source/linux/*nix/bsd) similar to LOVE2D?

    Posted: 31 Aug 2018 04:36 PM PDT

    Love2d now comes with some 3d support, but i'm looking for something that isn't lua. I am after a game engine / framework that is straight forward to quickly prototype a 3d game with. Can be any language, anyone have any suggestions?

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

    Java regex help

    Posted: 31 Aug 2018 07:38 PM PDT

    I want to select only the acestream link that contains the word "[1080p]". How would I go about doing that?

    acestream://3934281873ccca2d31d6a7ad2f520ed402403d4cd5 [HD] [EN] [1080p] acestream://3934281873ccca2d31d6a7ad2f520ed402403d4cd5 [HD] [EN] [720p] acestream://3934281873ccca2d31d6a7ad2f520ed402403d4cd5 [SD] [EN] [540p]

    these are dummy acestream links

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

    myself, and TA's can not figure out why this will not run

    Posted: 31 Aug 2018 06:55 PM PDT

    This is my answer to the Luhn credit number check challenge. I was assigned this at noon and I am still staring at it 9 hours later. If anyone can spot my errors, I would appreciate it. I am not asking for it to be solved, just see if I am way off track or it is just a simple typo or scope issue. Thank you. ```checkCredit = function(creditCardNumber) {
    creditCardNumber.split(' ')
    inputArr = creditCardNumber; /r///creditCardNumber.split('')
    let checkSum = function(inputArr) {
    for (i = 0; i < inputArr.length - 1; i += 2) {
    inputArr[i] = inputArr[i] * 2;
    }
    inputArr.reduce();
    if (inputArr % 2 === 0) {
    return true;
    } else return false;
    }
    console.log('works');
    return checkCredit();
    }
    checkCredit('23857385730');```

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

    Which language or system can download run the most number of possibly malicious code strings in 1 minute?

    Posted: 31 Aug 2018 06:20 PM PDT

    For example, a computer which does not correctly sandbox the first 1000 code strings that take 1 millisecond to run each, may crash from being hacked so could not make use of the remaining 59 seconds.

    I think its important to be able to run real world code, not just ui code in a browser, but stuff like number crunching and large scale collaboration between people, in a sandbox which can not inconvenience the user in any way such as to have to ctrl+alt+delete a "bad program" that was mistakenly trusted, should not have to trust it. Programming a multi user system across the world should not have to involve trust in not attacking eachother systems, should not have to depend on reputation but instead depend on that a program is instructions for what some computers and people may do together that does not in any possible case involve giving permissions for things that happen to exist on their computers before starting to do this thing together. For example, if a programmer distributes a security patch, that should have no effect on the security of the system it runs in since a hacker could not break through the sandbox the system runs in, where the patch is installed or not. If the security patch happens to not be installed, and the system is hacked, the risk is limited to what has been done within that multi user sandbox.

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

    PHP - "Notice: Undefined index:"

    Posted: 31 Aug 2018 01:52 PM PDT

    Hello, I am getting a "Notice: Undefined index: blah blah" on an older wordpress site. I have successfully repaired other PHP issues with 'isset', but I am having trouble with these specific 2 lines - 70 & 74. Any help would be awesome. Thanks!

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

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

    Is it considered bad style to create a class whose only purpose is to contain a list of other classes?

    Posted: 31 Aug 2018 03:57 PM PDT

    I'm writing a Java program to keep track of vehicles and their events. The events describe each time a vehicle moves (starting location, ending location, total time, etc).

    I created two classes: Vehicle and Event. Vehicle contains an ArrayList of Events and the vehicle id as data members, as well as various methods (findDistanceTravelled, averageSpeed, etc.)

    In my main program I've created a HashMap<vehicle_id, Vehicle> as a means of storing all vehicle and Event information.

    Would it be considered better style to get rid of the Vehicle class and instead create a HashMap<vehicle_id, ArrayList<Event>>, and move the methods into the main program as helper functions?

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

    How does a self-taught know they are ready?

    Posted: 31 Aug 2018 06:10 AM PDT

    I've been programming in Python 3.x since 2016, I've finished an internet course (for free on sololearn.com) and I've written several mini-programs.

    Since I didn't attend to any paid course and I learnt mostly by myself, how do I know how advanced I am in programming? Is there a list of skills that divides programmers in "beginners", "intermediate", etc...? How do I know if I passed a threshold that allows me to start a junior developer job?

    I'm really grateful for every answer.

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

    Want to become a software engineer - Am I able to?

    Posted: 31 Aug 2018 03:47 PM PDT

    Hello,

    Preface, I may be in the wrong subreddit for this, and if I am I apologize.

    To start, I graduated uni with a degree in biology and a minor in cs. As it turns out, I'm not a big fan of lab work, and/or relying on grants. I know C++ pretty well, visual basic, and have some python knowledge, and I somewhat know how to use github, that's it. Currently learning SQL, then JavaScript.

    What exactly do I have to... do? I don't quite know what requirements I need, or what kind of experience or knowledge I'm missing. I'm worried i may not even know what I'm missing.

    If anyone could help me with things that I can do to:

    1. Further my cs knowledge (in languages, processes, general things I need to know, etc.)
    2. To actually stand a chance at getting a software engineering job

    Am I even able to get a software engineering job without a cs major or am I screwed?

    Thanks for taking the time to help me out, in advance!

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

    Using Linux to develop for Windows with OpenGL

    Posted: 31 Aug 2018 07:37 AM PDT

    I am in my final semester of Comp Sci. I have a graphics class that uses C++ and OpenGL. I use primarily Linux but of course the class is all Windows based. The professor has said that I can use Linux, as long as the code compiles on her Windows machine and the executable I turn in runs on her machine.

    How hard would it be to achieve this? Is it going to be prohibitively difficult or is this pretty simple to achieve?

    Thanks in advance for the advice

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

    How would I create and self host a link shortener on my private network?

    Posted: 31 Aug 2018 08:35 AM PDT

    My job uses what they call "to links", where you can type "to/{resource}" to get to internal resources and pages. For example one link is "to/stack" which will redirect you to our private stack overflow instance.

    How would I go about creating and deploying a similar solution on my personal computer (and my home network)? I will only use it on my laptop and it doesn't really need to run when my laptop is off.

    Any help is appreciated.

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

    Is there any sort of platform to keep track of feature ideas users have for my software and perhaps allowing them to vote on features they think are most important?

    Posted: 31 Aug 2018 11:24 AM PDT

    How to patch a python package?

    Posted: 31 Aug 2018 11:06 AM PDT

    I'm currently using openpyxl in my Django project, but I ran into an issue with borders and merged cells. It's a known issue and there is a ton of discussion on the topic. The consensus seems to be this solution. I am unfortunately still new to python and I do not understand the flow of packages well. Where would I include the code that everyone agrees is the patch? Could I put it in a file in my Django project then include that in the views.py, where it's being used?

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

    Does a universal (across hardware) OS exist?

    Posted: 31 Aug 2018 09:36 AM PDT

    Does any such OS or tool exist already, that I can install this universal OS onto a flash drive, plug it into any computer, and boot into it? I need a universally bootable OS I can install to a small drive, and must be Linux. Have you guys seen anything like this before?

    I suspect it would be possible to do myself, by having a variety of distros for different processors installed onto different partitions, and some sort of indicator decide which distro to boot into. Does Debian already do this? to my understanding the OS must be compatible with the processor, is that correct?

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

    Weird Ascii thing happening

    Posted: 31 Aug 2018 09:35 AM PDT

    I'm making a beginner C cypher program that adds an ascii value of 1 to every character in a string.

    so abcde would be bcdef etc

    We're allowed to just do an override for Z (so i have a if statement that if the character is Z, make it A, and if its z, make it a.

    for some reason, lower case works. but upper case makes it "["

    I have identical code for both. I'm not using ascii values for the z's, i'm only manually changing every z to an a. z->a works, but Z-> A yields ]

    whats up?

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

    Really Easy But Time Sensitive question about writing a C program that tweaks ascii values

    Posted: 31 Aug 2018 08:58 AM PDT

    I'm in a comp architecture course so as kind of a preface to learning assembly language, the teacher is having us use a virtual machine to open a window with a unix interface and we're modifying files etc and they want us to make a short program in C. The program is simple: take a short input from the user "enter a word: " and then take each character in the word and add one to it ascii value. So "hello" would be ifmmp etc. It would be childs play for me in either C++ OR in c#, but this is literally my first time using C, and we aren't using an IDE, its all command line, so troubleshooting is hard as hell.

    Here's what i have so far and it just gives me gibberish (mind you, i'm aware i need to add code in to account for the user typing Z or z but i'm not even able to get to that point yet)

    include <stdio.h>

    define capacity 100

    int main()

    {

    char original[capacity];

    char modified[capacity];

    printf("Enter String: \n ");

    fgets(original,capacity,stdin);

    int cnt = 0, increment = 1;

    while (cnt!='\0')

    {

    modified[cnt]=original[cnt];

    ++modified[cnt];

    cnt++;

    }

    printf ("your string is: %s\n, modified);

    }

    Any ideas? The instructions say "Hint: Use two arrays of size 100 to store the initial and updated strings. Also use "fgets" function to read characters from the standard input stream and "printf" to display results. "

    halp plx

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

    Contrasting event sourcing/CQRS with traditional DAL/ORM?

    Posted: 31 Aug 2018 08:44 AM PDT

    I'm working on a web application that's growing significantly in terms of complexity largely due to a core feature of presenting logs on pretty much every entity and interaction. I feel like event sourcing would be an ideal implementation such that the history *is* the state of the system rather than independently tracking/manipulating transformations of state and event log separately (which is becoming unmaintainable).

    Looking into Lagom it seems like practically a perfect fit, but the emphasis appears to be on scalability which isn't relevant to me at the moment so I'm having difficulty understanding the core conceptual differences. My interpretation is that rather than persisting and recovering entity/object instances as needed there is an in memory cache of all instances and messages/events are validated, persisted in the background, and applied in memory. Is the data persisted in such a way that I can query it independently, or is the intention that this aspect is just a "black box" serialization and I have to commit to running everything through the framework moving forward?

    Ultimately I'm looking for: what am I giving up/losing in return for the guarantees that this [or a similar] framework provides? And is there a different approach I could be considering?

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

    Really conflicted as to which direction to go in

    Posted: 31 Aug 2018 05:51 AM PDT

    I'm a senior high school student (17 y/o). I've been programming for about 7 years at this point.

    A few months back, my school offered me the chance to represent the school at a pretty big national level high school competitive coding championship. For context, I had never been to a competitive coding competition before, only hackathons where we'd be asked to make something. I took them up on the offer, and started preparing. The preparation was quite fun. I decided to code in Python - the competition was not super focused on speed, rather plain accuracy. Learning more about the various in built methods in Python, many algorithms for common problems such as Dijkstra's, and even learning something completely new - dynamic programming, the build up to the competition was great. The preparation paid off - we came 2nd out of 98 teams. Shortly after there was another competition I was chosen to represent the school at, and we came 2nd of 167 teams. The two competitions really fostered a love for competitive programming in me. Problem solving and math in general is something I find pretty fun; shame I hadn't known about it earlier.

    About a year ago, I also started to learn about what machine learning meant. After a few months of being hesitant about whether I knew the required math or not, I just dived into the famous course by Andrew Ng on Coursera, and I enjoyed that a lot too. Watching logistic regression or neural networks predict correctly is honestly such a satisfying feeling - it kept me going. However, I had to stop taking the course about a month or so in due to heavy schoolwork, and so I've forgotten almost everything I learnt.

    With all the major competitions for my last ever school year over, I feel somewhat aimless. Whenever I had free time earlier, I'd be preparing for some competition or the other, whether it was competitive programming or hackathons. With all those gone, I really don't know what to proceed with. So I decided it was going to be one of the two - competitive programming or machine learning.

    With competitive programming, I know for a fact I find it fun. Watching that "AC" (accepted) pop up gives a high unlike any other. The catch is, I'm pretty sure at highly competitive levels and even at intermediate ones, people use C++ due to its speed - the only reason I got away with Python is that time wasn't an issue. So I'll have to pick up C++ 14 (without the OOP parts probably). Our school teaches us C++ 98 (yes, on turbo c++ sadly :( ), so I have a fair bit of a start already when it comes to C++ (assuming the two are at least remotely similar). Plus, the OOP bits are also dealt with at school, so that is not something I'll be taking up when it comes to competitive programming. I'm hoping the C++ I learn competitively will also assist me in the school exams.

    For machine learning, the little time I spent with it was pretty fun, and when I hear about all the cool things people are making and researching, it just makes me love the topic even more. I will almost certainly be taking up the topic in college, wherever I go (I'll also try my best to get in the college competitive programming team :D )

    So which one do I take up? I'm completely torn between the two. I need to keep in mind my somewhat heavy school load as well - I'm gearing up for some fairly competitive colleges (but at the same time I don't want to entirely obliterate my free time). This fact makes me think I lean a tiny bit towards competitive programming seeing the fair amount of effort that's needed, but then again competitive programming has its fair share of work too - learning the parts of the language I don't know, then learning common algorithms and their implementations, and then practicing problems (the last two being the fun parts).

    Please help me decide, and do leave any other advice you have for me, as a high school student who'll be in college majoring in Computer Science around this time next year.

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

    I developed a version of imgur that (in my opinion) works better and makes more sense. Is there a way to sell it?

    Posted: 30 Aug 2018 10:39 PM PDT

    Basically the title; I wanted to create versions of websites that I thought would be an optimal/less cluttered imgur.

    I'm really just looking for a place where people can sell their sideprojects. I've got a good collection of them but have a hard time finding anyone interested.

    Thanks for your help guys!

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

    What kind of storage/db approach for writing to an expanding single file?

    Posted: 31 Aug 2018 01:30 AM PDT

    Think of how Evernote works, you just write to this file(though it's a div/not a text area)

    I made a little note taking app with routing and it does a "on change update", using a TEXT data "type?" MYSQL

    The problem is, say I've got two instances of the same row open, and I made progress on the other one, I can overwrite the longer entry with the older/shorter one and I have accidentally and that data is just gone.

    I don't like the thought of writing to more and more and more rows but at the same time I want to guarantee that I don't do that(overwrite with less content). It's not about just a simple length comparison either.

    I like the instant save too(like on change) though I wonder if I should use local storage in combination with actual db request.

    Maybe I should just write multiple rows. But it sucks you know, you've got a row with thousands of characters, you hit spacebar, and you get another row with same thousand characters + space.

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

    No comments:

    Post a Comment