• Breaking News

    Sunday, November 25, 2018

    How can programmers be this stupid?! Ask Programming

    How can programmers be this stupid?! Ask Programming


    How can programmers be this stupid?!

    Posted: 25 Nov 2018 01:26 PM PST

    TL;DR - Someone writes system("touch ..."); when a call to fopen()/fclose() could've sufficed. When I call out in review comments, I'm told this is the way it's done and that it need not be changed. Arguing about the side effects led me to become the poster boy of r/iamverysmart. :(

    A few months ago, one of our customers had raised concerns that the firmware is slow. I hadn't worked on certain parts, but when I dug in I found some obscene amount of system() calls that invoked sed and awk to process text. It took a while to figure out that instead of retrieving and parsing text from an external process, we could simply invoke functions in the backing library and get the job done at a fraction of time - as in 8-10 seconds drops to 120-350 ms kinda difference.

    Of course, the firmware was already released in the wild and refactoring the code was not as easy. Now, a new firmware is being treated similarly with rampant use of system() calls for silly activities. I know this particular function will only be invoked in a corner case, but still encouraging this sort would lead to outcomes like in previous version. I called this out in review comments and ended up being ridiculed for being a puritan, a perfectionist and that I'm micro-optimising the code.

    I hate my job now. I wanted to vent. I'm done. Thanks for reading it.

    Edit: The comment reads verbatim:

    Calling system("touch..."); seems a bit too much for a simple task. Can you please change it to fopen/fclose and leave a comment around it suggesting why this function exists.

    I meant no disrespect to anyone. On a 4 MiB flash and a computer that runs at 150 Mhz on a good day, anything that need not exist should not exist for security and space concerns. BusyBox may well be trimmed down further and this function doesn't have any means to detect the presence of touch before invoking it. And then there is portability - Today it's Linux, tomorrow it could as well be VxWorks (talks underway).

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

    An overachiever programmer is making our lives hell and we don't know what to do... how do you deal with people like this?

    Posted: 25 Nov 2018 09:42 PM PST

    I want to get something out of the way from the start: I know this guy is good, and we all know it.

    The problem is he's making things really hard for us (we are 20-people company). He's a coding dragon, a workaholic who has no problem working from home after regular hour or during weekends, a guy who steps up to every challenge and never stops. The kind of person who not only tells our boss that virtually everything's possible, but also makes it possible...

    He's produced a lot for the company, and that's great. Lately, however, he's been offloading maintenance or updates on a lot of his stuff onto us because he's busy on new projects, and it's hell. Bugs come up, design choices are hard to understand, the code base is a mess, and sometimes, when we catch something wasn't done in a clean way, we get answers like "yeah, it's not the cleanest way to do it but there was no time to do it any other way".

    For example:

    • we got an email that a website he wrote was broken, so he forwarded it to us. A coworker of mine spent 2 hours trying to figure out what the issue was, and it was because of a bug on a function this guy wrote. He could have solved it in 15 mins likely. When my coworker pointed out that in the end it was his fault, he looked annoyed and ignored him.

    • our boss asked him to estimate a job, which he did. The job was then assigned to another guy but the estimate was kept, and this guy is going crazy trying to complete the assignment, saying that the first estimate (10 days) was clearly wrong.

    • I was asked to estimate something two weeks ago, and I said 2 days. For some reason, the same person also asked him later on, and he said "I looked at the code and this task takes 1 day", and they went with 1 day. WTF? Maybe I need more time, maybe I need someone to explain it to me, or maybe I still need to look at the code, etc. If the point is to show it can be done fast, then why doesn't he do it in 15 mins at this point???

    • When you ask him for help, most of the times his answers are "google it", or "I can't help you, you need to do it yourself", or "I can't do your job for you, sorry".

    • 6 months ago we had some issues finishing customizing a wordpress website, so he stepped in and we shifted to other things. The job got done and the client was happy. Last week a coworker of ours was asked to make some changes to the same website, and holly shit, he spent hours trying to navigate what this guy had done to make it work 6 months prior.

    • Finally, a client complained recently that the product was extremely slow. The product was written by him 2 years ago and then he moved on to other things. A coworker and I (we were now both in charge of the project) were trying to figure out the reason and eventually asked him for help. He found out that the problem was a function he had written years ago, and when he realized this, he said "well, guys, this was written 2 years ago, I haven't worked on the project for a year, you should have maintained the codebase" Unbelievable...

    Everything's like this. And because of his skills, management never tells him anything. How can handle a situation like this?

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

    What are some good 2D game development libraries for Java?

    Posted: 25 Nov 2018 12:09 PM PST

    I know that Java isn't the most popular programming language, but it's the one that I know fairly well. I've been developing a text-based game in Java using JFrames, but I really want to try making something that uses sprites and animations. Any suggestions for some libraries I could use? Thanks!

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

    App Store cost

    Posted: 25 Nov 2018 06:55 PM PST

    How much is it to put a prototype App onto the Google Play store? We've mulled over it for quite sometime...it's way easier for people to download off a familiar place.

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

    Final project

    Posted: 25 Nov 2018 08:06 PM PST

    Hey guys, I have a final project coming up where I have to create a simple game. I've already started some of it, but I don't really know how to code and I took the course to see if it would become something that interests me. Would anyone be willing to help me complete the project? It is simple and so I don't it would take much time. Thank you.

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

    What is the best language to learn programming concepts from?

    Posted: 25 Nov 2018 07:50 PM PST

    So like the basic programming syntax like arrays, objects, classes etc.

    I know it varies from each language but to get the basic grasp of programming knowledge should I learn c#, or python or JavaScript or what?

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

    What programming languages do I need for my web application project?

    Posted: 25 Nov 2018 07:11 PM PST

    I want to pay someone to fix a bug posted on the fixissues of github

    Posted: 25 Nov 2018 02:58 PM PST

    I wan to pay someone to fix any bug in this repo that is open... it has to be a bug. Price is negotiable. https://github.com/jupyter/notebook


    [link] [comments]

    Need help with very basic HTML/CSS/Java

    Posted: 25 Nov 2018 02:29 PM PST

    I am a graphic design student and part of my degree I am required to take a few web design classes. Nothing complicated, just the very basics you need to make an interactive website. I have sever ADHD and coding was not something I ever intended to pursue because I know you need a lot of patience. Although, I am good with keeping up on what to do in class, I struggle a lot with taking more time than most would doing anything to do with it. We were given a new assignment and it is to learn something new online and present how to do it in class. Lucky me I have worked 8hr shifts every night since the assignment was given out and it is due tomorrow. Theres no changing what I am doing it on, and I am completely lost. If someone could help me figure out what I am doing wrong that would be awesome.

    Here is the post I am following: https://novelist.xyz/tech/progressive-background-image-loading/

    Here is my codepen (I do have a css reset that is not included in this link. It wasn't made from scratch just one from google.): https://codepen.io/xzewish/pen/EORXVw

    Here is my file paths and image I am using if you need it:

    https://gyazo.com/c485c44188e123c1c3a27a77f6f58d7d

    https://gyazo.com/ae7aaf9ba7ebde8b5ea274f2775864e7

    Again, thank you for any help you have to offer.

    submitted by /u/6kylar
    [link] [comments]

    How can I access hidden dates on an archived website?

    Posted: 25 Nov 2018 06:01 PM PST

    To preface this, I have absolutely zero knowledge in regards to programming. What I want to do is access the 17 dates that are not shown on this archived website: https://web.archive.org/web/20031002051647/http://www.avengedsevenfold.com:80/tourdates/tourdates.php (and the hidden dates on older/newer versions of this website, of course)

    When I click on "Next" or "Show All Dates", it simply reloads the website. Is there a way to access the dates? I have skimmed through the source code, but didn't find anything. But the dates have to be somewhere, right?

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

    What do you use to test frontend applications that use websockets?

    Posted: 25 Nov 2018 07:26 AM PST

    I have an application that for the majority of it's functionality uses websockets.

    For example, when it comes up it creates a connection and the server sends it the following message:

    { type: 'server-init', client_id: '1' } 

    after which, it will display the client_id on the page.

    I would like a way to mock that message, and then test if the client_id is being displayed correctly.

    I never implemented frontend automated tests before, and I was considering of using puppeteer. However, from my short research and experiments with it, I found no way yet, to mock websockets.

    What do you use to test such cases?

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

    Need urgent help about a command

    Posted: 25 Nov 2018 12:36 PM PST

    I will give gold whoever finds the solution

    there is a bot for reddit chatroom I can set welcome message with command !setjoinmessage, before today I could remove the welcome message with writing the same command again but now it says:

    The string provided for the 'join-message' argument is too short; the minimum length allowed is 0 characters long.

    Can you check the code and tell me how to remove it?

    command: "setleavemessage [leave-message]", describe: "Sets the message for channel leavers. {USER} is replaced with the user's name.", handler: args => { const oldMsg = args.settings.get("join_message"); if (args.leaveMessage) { if (oldMsg === args.leaveMessage) { args.send(args.localize("update_leave_message_no_change")); } else { args.settings.set("leave_message", args.leaveMessage); args.send(args.localize("update_leave_message")); } } else if (oldMsg === undefined) { args.send(args.localize("clear_leave_message_no_change")); } else { args.settings.clear("leave_message"); args.send(args.localize("clear_leave_message")); 
    submitted by /u/Meteatas357
    [link] [comments]

    Is it a good decision to learn an additional course about Java spring for freshers?

    Posted: 25 Nov 2018 03:19 PM PST

    Chromebook for Programming?

    Posted: 25 Nov 2018 02:58 PM PST

    I'm buying a lightweight laptop for a friend for Christmas, he doesn't like lugging his gaming laptop to school for his programming classes. Will the chrome OS work with whatever software he would use?

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

    Best way to manage existing/new tags in mySQL?

    Posted: 25 Nov 2018 10:11 AM PST

    Problem is pretty simple: When I create a post, I want to be able to add various tags to the post, including both tags that are new and ones that already exist.

    The tags are stored in a simple table with their longform name and a simple autoincremented ID. The current logic I'm using is the following:

    1. I start with a row of string names of tags
    2. I execute a bulk INSERT IGNORE into my tag table (the name of the tags are set as unique so only new tag names will be inserted)
    3. I then use a SELECT * WHERE IN query with the tag names in order to get all the original names + the IDs

    Is this the most efficient way to do this?

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

    C++ Constructors

    Posted: 25 Nov 2018 01:08 PM PST

    Hey there! I'm learning C++ using a textbook and just came across constructors and destructors. My textbook talks about two types of constructors. The first type it simply calls a "constructor" and says it is automatically called whenever a new object is created. The second type it calls a "copy constructor" and says it is called whenever an object is copied (it gives the examples of being passed by value to a function or being returned from a function amongst others).

    The thing is, the prototype/declaration of these two is exactly the same apart from the parameters they accept. Neither returns a value and both must be called the same name as the class to which they belong to. The only difference between them is what parameters they use and that's something that the programmer decides. So how does the program know which function is which? Shouldn't they have different declarations (like a destructor, which can be easily recognised due to having ~ at the start of its name)?

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

    Seeds and Peers

    Posted: 25 Nov 2018 12:51 PM PST

    How do seeds and peers work?

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

    I want to learn how to do physical computing. Can someone recommend a starting point/learning path?

    Posted: 25 Nov 2018 08:56 AM PST

    I've got a raspberry Pi that was gifted to me. I took some basic programming classes in university a long time ago (C++, Matlab) so I have some understanding of programming at a very basic level.

    Can someone recommend some online courses I could take? I want to try to learn to automate some stuff in my home, maybe build an irrigation system for the garden, etc. I have no idea what language to use and how to source the sensors and parts, there seem to be millions of them and I'm totally unaware of what is available. I don't want to just follow a tutorial, I want to learn the mechanics of things.

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

    What are the qualifications to learn coding?

    Posted: 25 Nov 2018 12:22 PM PST

    Why need of '&' in Scanf() but not in Printf()?

    Posted: 25 Nov 2018 02:34 AM PST

    I know 'printf'()' only need the values in order to output them but 'scanf()' stores values, so it needs a place to store them. But doesn't printf() need address of variable to find the value to print?

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

    Reverse Polish Notation using recursion in Haskell

    Posted: 25 Nov 2018 04:46 AM PST

    I've been trying to create a recursive function to perform a RPS in Haskell, however I haven't been able to come up with a solution yet. Here is my step function that takes each variable from the input and carries out the necessary process to it.

    steper :: [Int] -> String -> [Int] 

    steper (x2:x1:stack) "+" = (x1 + x2):stack steper (x2:x1:stack) "-" = (x1 - x2):stack steper (x2:x1:stack) "*" = (x1 * x2):stack steper stack num = (read num):stack

    And here is the recursive function I'm working on

    rpnRec :: [String] -> Int 

    rpnRec [] = 0 rpnRec (x:xs) = head $ step [] x : rpnRec [] xs

    My attempts resulted in stack overflow errors and no parse.

    Here is the input I am using: rpnRec ["21","5","1","1","+","+","*","3","*","2","2","+","-"]

    Any help is much appreciated.

    Thanks in advance

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

    How do you create your own python module ?

    Posted: 25 Nov 2018 06:44 AM PST

    Javascript SPA design question - dynamic content

    Posted: 25 Nov 2018 06:20 AM PST

    I come from PHP and Python, where much of the sites content is stored on the database - such as navigation menu. Now I'm developing a SPA using Webix Jet and Adonis.js and I'm not sure how dynamic content should be handled.

    All Webix components (forms, datatables, etc.) are just JSON objects, such as:

    { view:"datatable", id: "dTable", width: 600, height: 700, select: true, columns: [ { header: "title", tooltip: true, width: 200, }, { header: "size", width: 100, } ] } 

    Right now I am dynamically rendering the columns in datatables - columns are formed based on the number of fields pulled. However, this leads to some inconsistencies when adding column settings that logic could fix, but it is somewhat cumbersome and where storing these settings in the database would be easier.

    To give another example, if I want to add a new menu item in the navbar, then I would add a record(s) to the database in Wordpress. Whereas in Javascript, it seems like this should be static.

    One solution I have come up with is to have 3 tables:

    views:

    id | view_name 

    components:

    id | component_name | group | view_id | settings ** settings is a JSON field and includes settings of components 

    user_settings:

    id | component_id | view_id | user_settings ** user_settings includes user settings for components and these override component settings 

    So is this the correct way to do this for an Enterprise grade SPA? Can anyone give me any thoughts/recommendations how this should be designed?

    I'd appreciate any help.

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

    How to pass data from one HTML page to another? and How to include data into URL as para's?

    Posted: 25 Nov 2018 03:52 AM PST

    I am doing a BMR Calulcator + Calorie counter, and my first page is where user input their info like height/age/gender, and I need to display these results on my 2nd page. Currently, I am able to display gender=male/female on the second page. I am also able to display Height/Age/Weight if I include them into the URL. Eg:xxx.html?gender=female+height=100+age=100 , and it will print out on the page as Gender=Female Height=100 Age=100

    But, I am unable to get the userAge/Weight/Height into the URL. I have looked around on github and stackedoverflow for help but there is no solution I could find.

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

    No comments:

    Post a Comment