• Breaking News

    Saturday, February 15, 2020

    If a computer runs at 1 Hz, how fast will it count through an empty for-loop? Ask Programming

    If a computer runs at 1 Hz, how fast will it count through an empty for-loop? Ask Programming


    If a computer runs at 1 Hz, how fast will it count through an empty for-loop?

    Posted: 15 Feb 2020 09:39 AM PST

    Selected Digit in Floating point values

    Posted: 15 Feb 2020 07:22 PM PST

    Is there even a way to print a specific digit from a float value? Example is that when we have 1 as the numerator and 7 as the denominator, we get 0.1428571429 as the quotient. Now the thing is I only want to print the 4th digit which is '8' and not the rest.

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

    Is this still normal?

    Posted: 15 Feb 2020 07:03 PM PST

    I just got a job as a junior developer at a small scale company (50+ employees) that earns millions. The job description is to become a Java Developer but later on, our boss decided to make us study React. I was pretty much okay with it because I wanted to learn new things even though it didn't really fit on the job description.

    Fast forward, I got involved with a few projects with me acting like a full stack developer (which is based on my job description, im not) and I noticed a lot of things :

    1. We don't have a code review -- Our own tech lead makes a lot of messy codes. I feel that for them, it doesn't matter which approach is better as long as it works. Sometimes I wonder what's the point of me researching for everything, applying the best practices when no one will notice it anyway?
    2. We're also the 'Database Administrator' -- We are expected to handle everything in the database, even with the database procedures. Currently, I am taking this as a learning opportunity because I only have a little knowledge about handling data. But then again, I am quite bothered because they want me to write procedures for MAJOR transactions. If they let someone as inexperienced like me write something this big, doesn't it make our system vulnerable and unsecure?
    3. We don't have a chance to work from home -- Yes, even if it's unsafe to go outside. Is there some kind of outbreak in your country and you're scared to go outside to work? Well, too bad.
    4. Our overtime pay takes a REALLY long time -- Sometimes, my coworkers don't even bother to file for an overtime pay anymore.
    5. Lack of Business Analysts -- This is really hard for some of my coworkers because they have to do the things business analysts usually do like talking to clients, making documents and discussing the business side of the system. I heard our boss even wants to completely remove the business analysts saying that their job can be done by the developers too
    6. Lack of documentation -- This one really frustrates me. Since there are so many projects with so little developers, they have no time to document their codes. I understand and respect that they don't have the time but our code base is really hard to maintain because of that

    Overall, I feel we are expected to do so much as developers that I am starting to question if this is still normal in the field.

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

    Why does my Neural Network not learn?

    Posted: 15 Feb 2020 09:25 PM PST

    Hi there, I'm trying to create a neural network that is capable of classifying 'doodles' to a label.

    Specifically, I'm using Google's Quick, Draw! Data set to try to train a neural network to be able to recognise 3 different types of doodles. Those three doodles being a cat, a cookie, and a rainbow.

    I'm using ML5.JS to try and train my neural network.

    I am inputting the drawing data that google provides as inputs, and the drawings' associated labels as the outputs.

    Then, I am testing the neural network with a test drawing input.

    But the results I am getting from the classify() method of my test are really bad.

    The classification it makes is about ~33% confidence of it being each of the 3 options (cat, cookie, rainbow) - meaning I think it really has no idea what the test drawing is...

    Something even stranger is that when I test it with one of the EXACT cat drawings that I trained it with, it still doesn't recognise that the drawing is a cat. And gives a 40% confidence that it's a rainbow!

    I am a noobie to ML so I apologise if this isn't enough context but am really looking for some help on how to properly train my neural network to classify my doodles.

    I have posted the code of my neural network in the comments.

    Thanks in advance.

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

    Which programming language to use for competitive problem solving and face-to-face interviews?

    Posted: 15 Feb 2020 08:28 PM PST

    I am programming in Python 3 for almost 1.5 years now and quite good with it. But I've read many articles that Python is slow and is not appreciated to be used in competitive problem-solving. And most of the companies do not appreciate python to be used while explaining stuff to them.

    I know a bit of Java which I learned like 1 year ago and some of C++ from my high school. I mentioned these two languages because I've heard these could be used for this purpose from many people. So, which programming language would you suggest me to learn. [ You can also suggest other languages than C++ and Java ]

    Thanks in advance...

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

    Is there a "torus" mapping for the mouse in Windows? Mousing off the left edge of screen would make pointer emerge from right edge. Mousing out of top edge would bring pointer out of bottom edge of screen.

    Posted: 15 Feb 2020 06:31 PM PST

    Like the old video game Asteroids or PacMan....going out of any edge of the screen teleports you to the opposite edge.

    The idea is simple enough... But is there a way to employ it in my OS... Windows in this case?

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

    How do most development teams work with multiple languages in the same project?

    Posted: 15 Feb 2020 02:11 PM PST

    so, I am getting to a point where I want to tackle using multiple languages on the same project, and while I still need to figure out how to accomplish this.... I was wondering how professionals in the industry handle this topic.

    you have people working on different parts of a project, and some of those parts use another language, how do you work with the other teams using another language without breaking your program or slowing development?

    and if anyone has the time to point me to a tutorial or something I can read on using more than one language in a project i would really appreciate it :) . at the moment I can code with C,C++, java, and JavaScript(and extensions). I would like to work on a project that uses C and JavaScript for a project i want to do on my pi, that same project has someone using python XD.

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

    copy and paste

    Posted: 15 Feb 2020 07:19 AM PST

    i use Mac at my new company and a normal Linux laptop at home. I keep pressing the wrong key at work and home, for the most important task —> copy/paste for sure! Especially when switching b/w terminal and browser..

    Copy: ctrl + shift + c / ctrl + c / cmd + c

    Any suggestions.. on making my copy and paste life easier? How you get over this?

    I once tried key binding on my mac but it worked terrible..

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

    How to compare PHP trace files?

    Posted: 15 Feb 2020 04:55 PM PST

    I'm trying to find the important differences between two xdebug trace files. The two trace files are similar but there are a lot of irrelevant differences between them such as request time, remote port, uptime, queries per second, etc. I'd like an easier way to find the difference that matters. So far my strategy has been use diff to find the lines that differ, then look at those two very long lines to try to find the difference. Then when I find the difference replace the differing text with a place holder (suppose the difference was port number, in that case I'd use sed to replace the port numbers with PORT_NUMBER in the two files) I started doing it this way but I keep seeing more and more irrelevant differences, so I'm wondering if there is some better way I can compare the two files and easily find and ignore the differences that don't matter, so I can find the place in the trace file where something went wrong.

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

    difficulty finding a master degree for my project

    Posted: 15 Feb 2020 04:50 PM PST

    I have a bachelor degree in computer science, I intend to do a master, I have trouble finding the best subject that suits my project. Currently, I have experience in software development and this is how I want to pursue my career.

    I wanted a subject where I could learn advanced software engineering, ML, AI, I already know that each of them can be a master's subject and that AI could cover these three subjects but I think that my career path doesn't allow me to start directly with AI which requires a lot of credit in mathematics, I wanted a master's subject which could cover these three areas, this is why I am asking your help today for advice.

    Regards !

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

    Are there any simple web frameworks in C?

    Posted: 15 Feb 2020 03:28 AM PST

    Please bear with me, I'm an absolute noob when it comes to web programming. So please pardon my stupidity.

    I have a small IoT device that's supposed to host a minimal good looking website that shows live logs, data transfer graph, etc. The device has a total of 16 MiB and has about ~5 or so MiB left in it.

    I was browsing through various web frameworks and most of them seem to be complex behemoths built over NodeJS. Hand coding CSS/JS in 2020 seems like an odd thing to do according to experts at stack overflow.

    So here's what I've done so far. I use lighthttpd to run the server and serve a few pages. Then I somehow figured that Angular2 (or whatever that shit is) is completely static and I can copy the build/ directory to the device and have litthttpd serve them. It works fine.

    I don't have enough space left to insert PHP or anything else. So I figured I can open a websocket and have a custom lighthttpd plugin provide JSON to it and things seem to be working fine. But then the build/ directory is now larger (about 700 KiB) and my C side plugin has grown bigger too.

    Was wondering if you guys have a simpler solution that needs less hard work but gets things done just fine in such constrainted environment? I'm searching for simpler solutions here only because most of my teammates aren't web experts either. So keeping things simple will alleviate some maintenance in future.

    Edit: I've tried the one that comes with OpenWRT. It looks cute on the surface but there's lots of work to be done to get it functional. Its almost as if I'm reinventing the wheel. So I chose to do it slightly differently.

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

    [JS] If using global variables is illegal, how do I then store a value which I need to access from various places and change?

    Posted: 15 Feb 2020 08:44 AM PST

    Imagine this:

    var current_selection = "id_of_element_one"; element_two.onclick = function() { getElementById(current_selection).className = "unselected"; element.two.className = "selected"; current_selection = id_of_element_two; } 

    How could I store this value inside of some function, if I can't access it there?


    And some of my other problems stem from this. I will have like 10-15 menus like this. That means I would either have to have 15 global variables, or throwing them into an object so they are nice and together. Or, I would have to recycle the one variable, and after switching to another pseudo-window (I use hiding parent elements instead of actual windows, it's lots of fun), set the global variable to the id of the first element in the new window.

    Frankly, I think that using element_id-s is kinda lame because it requires you to know the actual string. Why can't I just say: "gimme row nr 2 in the table, and set its className." That would be cool.

    What do ?

    Tnx!

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

    Options to navigate a website autonomously: webdriving a headless browser, sending a sequence of http requests - anything else?

    Posted: 15 Feb 2020 04:05 PM PST

    What comes to mind:

    webdriving (including headless & non headless).

    sending raw requests.

    simulating user-interaction (typing, clicking) from an operating system -> browser level?

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

    Grad Level CS Classes?

    Posted: 15 Feb 2020 09:49 AM PST

    I've taken a class on motion planning and now am in AI (mostly the same as the Berkeley one). My experience thus far is that professors just kind of talk really fast over their slides and sort of expect you just know all the field-specific terminology and concepts. The assignments also seem to be mostly sifting through someone's spaghetti to come up with something for a loosely defined goal graded in a specific manner, e.g. "Make this function better, but also we're not going to tell you what it does or what it needs to make it better". Is this a normal experience? Am I screwed forever?

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

    Generating large Excel files quickly

    Posted: 15 Feb 2020 11:54 AM PST

    Hi All, We have a business requirement to generate large Excel files (300+ columns, 300k+ rows, with number formatting and freeze panes) and our current implementation takes tons of memory and is quite slow. Right now its done in our web application, but I think it would be best if we move this to a separate worker cluster that generates these reports and store it on AWS S3 for retrieval.

    What's the fastest way (any technology) to generate Excel files like this? Ideally, I'd want it complete within 5 seconds. Right now we use SXSSF but it can be quite slow. Perhaps the developer on my team has improperly implemented it, but it can take some time to generate (30-60 seconds) and it uses tons of memory (4 gb+). My concern is the web app is very easily crashed if multiple users are retrieving these files at the same time (like in a meeting).

    What's the best way people have found to build large Excel files with a relatively low memory footprint?

    Thanks in Advance

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

    How come some container datatypes (set for python; forward_list and vector for c++...) have a fixed size, no matter the element count?

    Posted: 15 Feb 2020 12:51 PM PST

    While fooling around I found that forward_lists, vectors in c++, and sets in python always have a constant size no matter the element count.

    To get the size of a variable I used the sizeof function in c++, and the dunder method __sizeof__() in python. On my pc, for a forward_list<int> it's always 8 bytes, for a vector<int> it's 24 bytes, and for a set it's 200 bytes. For other collection datatypes, like arrays, it depends on the element's datatype and the element count, as well as for lists in python and that makes sense, since they store multiple variables.

    So how come the container dataypes mentioned above always have a constant size? What's going on there?

    Any help is appreciated:)

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

    Critique my code - Python/nmap Automation

    Posted: 15 Feb 2020 11:14 AM PST

    Hi askprogramming! I've been teaching myself python and for one of my projects I built a simple automation script to scan my home network for new devices on a regular basis. If you have the time I would greatly appreciate any feedback on structure, style or anything else. Much appreciated!

    https://github.com/secastles/netscanner

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

    Simple library for 3D graphics(Java/Python preferably)

    Posted: 15 Feb 2020 07:15 AM PST

    Looking for a simple tool to draw basic 3d shapes (Kind of new to programming),

    Something that allows me to draw (L,B,H) rectangles at a specified coordinate(x,y,z). and that is pretty much it, also maybe change camera positions.

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

    Can you sum running times using Big-O notation?

    Posted: 15 Feb 2020 10:34 AM PST

    I'm trying to understand better the Big-O notation, because it is pretty popular among interviews. I've already read this excellent post: https://www.reddit.com/r/programming/comments/1f2ml3/what_does_olog_n_mean_exactly/ca691yj?utm_source=share&utm_medium=web2x

    So:

    void Foo() { for (i = 0; i < arr.size(); ++i) Bar(); // Let us assume Bar completes in O(1), for simplicity. } 

    Foo completes in an average time of O(n). Where n is arr.size(). Am I correct so far?

    Again:

    Void Foo() { for (i = 0; i < arr.size(); ++i) for (j = 0; j < arr.size(); ++j) Bar(); } 

    This is an O(n2) average time. Correct again?

    Now, I can't find an answer anywhere on what happens if Foo is:

    void Foo() { for (i = 0; i < arr.size(); ++i) Bar(); for (i = 0; i < arr.size(); ++i) for (j = 0; j < arr.size(); ++j) Bar(); } 

    What if you end up with this sort of code? Do you have to sum O(n) + O(n2) ? Or is the average time still O(n2)?

    Thanks in advance.

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

    [JS] If having a function with lots of null or false parameters is wrong, what should I do if I need to pass lots of parameters to it, but only very few will actually have a value?

    Posted: 15 Feb 2020 08:49 AM PST

    Imagine this:

    function createNewHtmlElement(tag, parent, id, class, img, src, click, hover, title) { var child = createElement(tag); getElementById(parent).appendChild(child); if(id){child.id = id;} if(class){child.className = class;} if(img){child.img = img;} if(src){child.src = src;} if(click){child.onclick = function(){click};} //no way to have parameters. very sad. if(hover){child.onmouseover = function(){hover};} if(title){child.title = title;} } 

    Now, you see we have some checks for parameters which will be 0 or false or null or whatever, so they don't mess up the code. But if we wanted to make some major creation function that creates all the elements at once, the array holding all the creation data would look like this:

    var creationArray = [ ["DIV", "parent1", "id1", "class1", false, false, false, false, false], ["BUTTON", "id1", "id2", "class2", false, false, clickfunc, hoverfunc, "title1"], ["IMG", "id2", "id3", "class3", "img1", "src1", false, false, false], ["DIV", "id2", "id4", "class4", false, false, false, false, false] ] 

    And with this, we can just pow pow pow create everything by just looping through the array. BUT. You see there are lots of false values.

    So should I :

    1. use a different create function for each type of element (but there might also be many false values regardless)

    2. have the one function, but several "extended" versions of it, where each subsequent one has all the previous ones in it, but also some extra stuff

    3. c'est la vie and do it like it is and live with false values

    4. don't use functions (people say that if you have more than 2 parameters, that you are doing something wrong. Welp)

    5. something else

    Tnx!

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

    Job interview help

    Posted: 15 Feb 2020 08:10 AM PST

    A resource for learning C++03 for experienced programmers?

    Posted: 15 Feb 2020 07:38 AM PST

    I have done a lot of programming in a variety of languages (Haskell, Java, Scheme(Racket), Python). I even did C++ a long time ago (10+ years). Most of the books and resources I've come across try to teach how to program and is really slow for me. I need a resource to quickly hit the ground running with C++. I have to work with this existing codebase that was written in C++03. Books are preferable, but I don't care if its a video or slideshow, so long as it's self contained (contains everything I need about how the language works). Thank you for your help.

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

    How do price comparison websites work ?

    Posted: 15 Feb 2020 03:29 AM PST

    How do websites like pricerunner work ?

    Do they write scrappers for every single website ?

    any information about this topic from a programmer's standpoint is really appreciated.

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

    No comments:

    Post a Comment