• Breaking News

    Monday, June 8, 2020

    Programmers who are also fiction writers, which is harder? Ask Programming

    Programmers who are also fiction writers, which is harder? Ask Programming


    Programmers who are also fiction writers, which is harder?

    Posted: 08 Jun 2020 12:53 PM PDT

    Which is harder, writing or programming? Why?

    What skills are useful for both disciplines?

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

    Looking for resources to learn the math required for machine learning.

    Posted: 08 Jun 2020 09:37 AM PDT

    Hi guys. I'm switching over to programming from a different career path and, while I'm not currently working in machine learning, it is an area that interests me and that I'd like to learn. I do have some background in mathematics and statistics specifically, though not extensive and I haven't been using those skills for some time. I'm looking for literature suggestions to get back into math, more specifically, math related to the kind of data science used in machine learning. I like to understand things in-depth so I don't want just a cursory explanation of how to, for example, implement a normal distribution.

    To give you an idea of where I'm at, I can do some basic calculus, I used to know more but can't remember any of the "tricks" that are used to do more complicated operations. I have a cursory understanding of statistics and probability, and could do some simpler calculations, though I've mostly forgotten the more advanced stuff due to disuse. I recall what a chi-square or KS test is and what they're used for, but I'd have to look them up to actually make use of them.

    So, in summary, what I'm looking for is literature (not necessarily books, I'm fine with online courses etc if they're well made) that will brush me up on / teach me the theory and also provide enough problems to solve so that I can retain the information.

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

    Programming & Health

    Posted: 08 Jun 2020 09:49 PM PDT

    We spend hours typing or sitting on an uncomfortable position, which leads to a variety of health issues. As a gym-goer, I have found that my wrists and elbows have taken a huge impact from all the typing and unnatural elbow positions. Fellow programmers, any advice to lessen the pain from this?

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

    How do you write a very efficient code?

    Posted: 07 Jun 2020 11:41 PM PDT

    While doing some LeetCode exercises I noticed that they also included the total runtime of my algorithm. Quite disappointing that I write a runtime inefficient code.

    I noticed that most of the fastest running algorithms used data structures, some are very compact code. Although I noticed that some of the fastest algorithms are copy pasted from the net, which I guess defeats the purpose of LeetCode (for me LeetCode is to test you algorithm writing skills)?

    Also any reading materials for Big O notation?

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

    How do you charge clients for travel?

    Posted: 08 Jun 2020 11:02 AM PDT

    I have a client that is half way across the country that wants me to come out for the week and do some training and development.

    I will be booking my own flights, hotel and rentals.

    Do you typically give them a flat fee that covers travel costs and estimated hours or do you itemize each expense in your final bill?

    Do you charge for the hours it takes to travel to their location?

    submitted by /u/angels-fan
    [link] [comments]

    Is there a name for the type of programming where you just use components, likes React or Flutter?

    Posted: 08 Jun 2020 08:26 PM PDT

    I've tried out React and Flutter and noticed how they're very similar in that everything is essentially a component, similar to how in Java everything is an object. My guess is that React and Flutter are therefore called Component-Oriented Programming Languages? In Flutter they're called widgets.

    So I'm wondering if there is a general name for these kinds of languages. I feel like a big part of them is that these components/widgets also involve states.

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

    A language with potential, which should I learn? (Can do C++, 16 y old)

    Posted: 08 Jun 2020 12:50 PM PDT

    Hello, I'am programming for 6 years now, i'am not a pro and I can only write C++(Arduino) Code. I also experimented with html and CSS. The basic stuff, nothing special. So mainly I can do c++.

    So I was wondering which programming language is (worth it) the best to learn next, something which I can use to make some money with or to be good for my career. It should be a popular language which can be used in many ways. Nothing like Arduino, which can be only used for Arduino boards. Thanks.

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

    Salary negotiations

    Posted: 08 Jun 2020 05:54 PM PDT

    I'm applying to a software developing role in education and I don't know how much to ask for. On one hand I know the average salary for that city, but can I expect the same salary from a non-profit org? I don't want to over/under value the role, but I have no point of reference. Does anyone doing non-profit work have any tips to approach this conversation?

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

    what designs need to be in place to properly employ test driven development doing embedded firmware?

    Posted: 08 Jun 2020 10:16 AM PDT

    whenever i read articles about test driven development being a great thing i always attempt to bridge that into the types of job experiences i've had over the past 15 years and how it could even be integrated into the task of deploying a system for a product that in general, doesn't even come with unit tests for the very hardware itself that you are supposed to deploy? e.g. you buy a processor off the shelf that comes with all sorts of specialized hardware functionality that comes with no means of verification for the things of which you request of it, or if they do can only be verified by separate hardware equipment, or analysis of the functionality of a hardware sensor data stream

    i'm just being obstinate but what are some effective ways to properly unit test systems that are heavily depending on specialized closed source hardware? there's a massive thing with which you are provided, and it comes with a virtually infinite API already that comes with no unit test, so what approach does the design need to make to create a unit testable system?

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

    Advice on how to crawl thousands of university departments

    Posted: 08 Jun 2020 07:56 AM PDT

    For the last few weeks, I have been a part of a team that is building Labmojo, a search engine to make it easier to find & contact researchers. We launched last week, and the feedback has been great. We are now looking to expand the number of researchers we have indexed. The problem is I have been the sole engineer working on the project and I don't scale very well.

    Problem From the 50 or so universities I have crawled, it is rare for a university to have a single directory for the faculty. The most usual case is every department has its url structure, research faculty page(s), and page designs.

    So Far I built ~50 Scrapy spiders to crawl each department website for researchers & their information. This worked as a proof of concept but as we are looking to scale up to add every university and department, I am trying to think of different approaches (vs brute-forcing it writing thousands of spiders for each department).

    Question Does anyone have any ideas on how to best approach this problem?

    Potential Solutions * Go the thousands of spiders route + open-sourcing the repo. This way I am not the bottleneck, and others can contribute (something people have already asked to do).

    • An open-source, general spider that takes a list of university pages, and looks for pages that look like directories. This would be more complex (I think). I haven't built a spider like this before so I am not sure.

    • Look for the data elsewhere - maybe this data is somewhere else?

    Any ideas?

    Thanks in advance for your help!

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

    Who is right in this argument about an integer overflow bug?

    Posted: 08 Jun 2020 03:57 PM PDT

    I would like to ask the considered opinion of /r/AskProgramming about a dispute I've been having with /u/Rombartalini concerning this article describing a bug that Youtube had in 2014 where the view counter for "Gangnam Style" overflowed a signed 32 bit integer.

    The debate has devolved into name-calling and each side telling the other they are ignorant and incompetent. It is clearly going nowhere, which is why I proposed asking for third party opinions.

    The view of /u/Rombartalini is (using only direct quotes):

    • Merely recompiling the code from 32bit to 64bit operating system would take care of the problem. No need for new code.
    • Fixing the type of a variable like view counter to 32 bits is stupid.
    • The type of int is the same whether it is implemented in 32bit or 64bit. Your code shouldn't care, and if it does, it's crappy code.
    • Whether there will be a difficulty recompiling onto a 64bit system is a function of whether the underlying code is crappy.
    • Using a fixed 32bit int as you suggest will, without question, cause portability problems.
    • The language doesn't matter. It's never been relevant.

    My view (mostly quotes from the thread, slightly modified):

    • The article uses INT_MAX only to explain the concept ("The maximum value of this number type, 2,147,483,647, is well known to C programmers as INT_MAX."), which does not necessarily imply that the Google code in question was C code.
    • It almost certainly wasn't C or C++ code because almost nobody has been writing web applications in C or C++ since the mid-1990s. Even for a video site, you wouldn't use C or C++ for the UI.
    • Even if it was, it's unlikely that the variable in question was a plain int rather than a fixed-width int32_t or something similar, because in modern C or C++, you choose the width of variables in your data structures deliberately and don't leave it to the compiler, in order to control your memory usage and keep the logic more predictable.
    • Even if it was, it's extremely unlikely that the system was previously compiled for 32 bit but running on a 64 bit OS and hardware, because almost nobody running their own application on their own production servers would compile it for a different platform and then run it in an emulation mode, unless they had some very weird special case requiring them to do so.
    • Even if they did, you would never fix a bug concerning a single variable by changing the platform the application is compiled for. Your target platform is a conscious choice you make for technical reasons dictated by the technical infrastructure, you don't change it to fix a simple bug in the application logic.
    submitted by /u/brazzy42
    [link] [comments]

    Is it wrong to expect software vendors to sign their code?

    Posted: 08 Jun 2020 03:19 PM PDT

    I recently discovered that one of the enterprise applications that my company uses gets blocked by smartscreen (Edge Chromium) when attempting to download the installer. I inspected the file after downloading it with another browser, and found that the installer is unsigned. I brought this to the vendor's attention and they suggested that we just whitelist their domain. Am I expecting too much that a software development firm with more than 100 employees should be signing both their applications and the respective installers? Is this not just standard practice? Thanks in advance.

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

    Wrong touch typing?

    Posted: 08 Jun 2020 03:02 PM PDT

    I started using a PC when I was 5, and since then I've been using it a lot and of course I learned to touch type really good, 100 wpm is not a problem even on my tine 13" macbook keyboard. But now I started learning `vim` and I noticed that I actually do a lot of things wrong. My hands change position often, so that I never use a pinky (e.g. I move ring finger for `tab`), and if it is actually not that bad for typing overall (as you rarely use keys that are close), it becomes tiresome when you use a lot of keybinds. Does anyone have similar problem? Is it really that wrong?

    But moving hands actually helps with pain, my wrists did never hurt.

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

    Spring Security AuthenticationManager checks only password

    Posted: 08 Jun 2020 02:56 PM PDT

    0

    I am having an issue with the way I check credentials using AuthenticationManager
    . I have the following code:

    SpringBootApplication.java

    @SpringBootApplication public class SpringSecurityJwtApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(SpringSecurityJwtApplication.class); } public static void main(String[] args) { SpringApplication.run(SpringSecurityJwtApplication.class, args); } } @RestController public class HelloWorldController { @Autowired private AuthenticationManager authenticationManager; @Autowired private JwtUtil jwtTokenUtil; @Autowired private MyUserDetailsService userDetailsService; @RequestMapping(value = "/access-token", method = RequestMethod.POST) public ResponseEntity<?> createAuthenticationToken(@RequestBody AuthenticationRequest authenticationRequest) throws Exception { try { authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(authenticationRequest.getUsername(), authenticationRequest.getPassword())); } catch (BadCredentialsException e) { throw new Exception("Incorrect username or password", e); } final UserDetails userDetailse = userDetailsService .loadUserByUsername(authenticationRequest.getUsername()); final String jwt = jwtTokenUtil.generateToken(userDetails); return ResponseEntity.ok(new AuthenticationResponse(jwt)); } } 

    AuthenticationRequest.java

    public class AuthenticationRequest implements Serializable { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } //need default constructor for JSON Parsing public AuthenticationRequest() {} public AuthenticationRequest(String username, String password) { this.setUsername(username); this.setPassword(password); } } 

    MyUserDetailsService.java

    @Service public class MyUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { return new User("userTest", "passwordTest", new ArrayList<>()); } } 

    The issue I am facing with is that this line

    authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(authenticationRequest.getUsername(), authenticationRequest.getPassword())); 

    succeeds even if my username is incorrect.

    For an example,

    curl -X POST -H "content-type: application/json" --data '{"username":"wrongUser","password":"passwordTest"}' localhost:8080/access-token 

    will return a 200 response, while

    curl -X POST -H "content-type: application/json" --data '{"username":"userTest","password":"wrongPass"}' localhost:8080/access-token 

    will give back an expected 403 error. Any idea what might be the issue?

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

    What are some of your favourite online courses/training videos?

    Posted: 08 Jun 2020 02:53 PM PDT

    Hey everyone, title pretty much says it all. The reason I ask is because for the next month or so I have some major downtime at work for various reasons, so my boss has recommended I look out for training videos to occupy my time. I'm pretty early in my career (nearly 2 years of .NET Development) so there's still tools that seem pretty important that I'm only learning about now.

    One I found to be great has been "Learning Docker" on LinkedIn Learning. As someone who had never used docker before, I came out of it with a pretty decent understanding of its applications and how to use it.

    Have you found anything interesting lately either to upskill or pass the time?

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

    What video player supports writing custom plugins?

    Posted: 08 Jun 2020 02:53 PM PDT

    I want to write plugin for some video player that would enable me to store timestamps of keystrokes related to the currently playing media file. I want to be able to pause the video and keep the keystrokes in sync with currently played media, so something like 3rd party "key logger" is not an option.

    I want to use this to create metadata for movies when something relevant happens instead of writing current movie time to text file manually. It would be nice if there would be an option to create some sort of popup that I could use to enter some text related to the current marker time, but this is just nice to have.

    I've briefly looked into VLC plugins but I couldn't find any easy "quick start" tutorial that would help me get started. I want to use this only on my local win10 machine and I'm fine with basically any programming language, but I prefer python, js, c, java

    Thanks for any suggestions

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

    Sending requests via proxy is too slow

    Posted: 08 Jun 2020 02:35 PM PDT

    I bought proxies and I making Guzzle requests to the API via proxies. Some requests are fast, 1-3 seconds, some last 30 seconds, a minute or more.

    I can't figure out why is that? Why are API requests taking so long via proxies. They are not free proxies. I tried to test by sending the same requests directly from my own server and it takes 1-2 seconds each request, every time.

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

    Discord

    Posted: 08 Jun 2020 02:11 PM PDT

    Somebody Cn recomend me some discord servers?

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

    Best HTML/CSS/PHP editor? (bonus points if it can edit files on a remote PC)

    Posted: 08 Jun 2020 02:03 PM PDT

    As the title says, what editor do you use?

    I use Brackets,but am currently having problems with editing files on my homelab server,and also it seems to have fallen out lately,as I cannot really find too many resources on it. Any alternatives?

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

    Installing a COM Server?

    Posted: 08 Jun 2020 02:00 PM PDT

    I'm working on integrating some shell context menus similar to how WinRAR works but for another format and another purpose.

    I've done this before but back then I chose to do it via editing the registry to install and uninstall it via a small program I made.

    It seems like this is considered bad practice and that it's encouraged that you build a COM server and use a library such as SharpShell.

    I would love to do this but I'm having a hard time finding information as to how I should package it for distribution so other users can install and uninstall it.

    Always found this kind of information hard to find so I've always just released my programs as ready-to-run executable.

    Any pointers in the right direction would be appreciated! I know it's a bit different than releasing an application so I'd love to try and do it "right".

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

    Site functionality allows for a manual click, but not javascript click() function or MouseEvent.

    Posted: 08 Jun 2020 01:11 PM PDT

    I am attempting to write a script to automate some tasks on a third party site. The very first step is simply clicking a div on the nav, but document.getElementById('myId').click() does nothing.

    In my searching I found this answer that fully simulates a mouse click.

    However, that also does not work. I did notice that there's a class added when hovering, and the script successfully simulates that. And obviously physically clicking works fine. I'm not sure what else I could be missing.

    Edit: It turns out that the clicking was just fine, but the site is actually checking pieces of the event such as the coordinates, which is why it appeared to not be functioning properly

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

    Making the move from novice to mastery.

    Posted: 08 Jun 2020 12:18 PM PDT

    I hired a couple people with zero programming experience about a year ago and spent time teaching them the basics of programming in Python. They are both now at the point where they can write simple programs. For example, given the task of writing a crawler, they can write the crawler, parse the data, and so on. They can interact with Redis, Elasticsearch, and other services. They know how to use libraries such as requests, and they can read the docs.

    This is great. Their code is still a bit lacking at times, and I find they often make simple mistakes (e.g., rather than using a dictionary, they will have a bunch of variables named foo1, foo2, and so on). So at this point, they can hack things together, but they still do not have a good understanding of the fundamentals.

    I've been having them work through Python Koans lately while I try to figure out how to take them to the next level. I guess that would be the level where they really understand programming. I was thinking potentially having them sit down and learn Java, C++, or another strictly typed language where you have to really think about data types, private vs. public, and all the other things one takes for granted when using Python.

    Just curious if anyone has any ideas here. I don't care about them mastering a language. I'd like for them to really understand the fundamentals of programming (design patterns, data structures, and so on).

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

    C double pointers

    Posted: 08 Jun 2020 07:26 AM PDT

    Perhaps I've been wording it the wrong way for search engines so I'll ask it here.

    I have a void pointer in a struct and then a pointer to this pointer. From my understanding of pointers when I do *pointerTopointer = "string" it should write "string" over the static char that my initial pointer points to.

    Instead of that I the memory address of the static char in the static char.

    void *p = &static char; char **pp = p; **pp = "string" 
    submitted by /u/MLquest
    [link] [comments]

    No comments:

    Post a Comment