• Breaking News

    Tuesday, April 16, 2019

    Why learn assembly? Ask Programming

    Why learn assembly? Ask Programming


    Why learn assembly?

    Posted: 16 Apr 2019 02:57 PM PDT

    Most modern languages use a compiler to run code, so is there really a point to learning assembly besides understanding what a compiler does behind the scenes?

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

    In just over a month I'll be starting my first job as a Software Engineer, anything I should know?

    Posted: 16 Apr 2019 03:59 PM PDT

    Hi everyone,
    Mid-May I'll be starting my first job as a Software Engineer at a large company and having only ever had a retail job before this, I'm not really sure what to expect. Anything I should look out for or make an effort to do? Any advice at all would be much appreciated. Thanks!

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

    Hi! I require help with a project

    Posted: 16 Apr 2019 01:18 PM PDT

    Hi! I require help very fast. I submitted my final project but apparently there were some issues with the code which I had missed, but they are giving me a chance to fix it. The problems are footer overlapping when scrolling, global nav links not working on index page and apparently im mis-using the header element. Please help, how do i fix? They only gave me until tonight to fix it and I'm stumped. I tried fixing the header issue by replacing it with "main" but it screwed everything up. What should I do?

    The code is here: https://github.com/glassen75/firstwebsite

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

    Did this man just implement church numerals in scheme?

    Posted: 16 Apr 2019 09:37 PM PDT

    Recently I have been learning some scheme for fun. I was browsing a series of scheme videos on youtube and found a video about lambdas.

    I know what lambda calculus and church numerals are but have never used it or put in the time to learn their implementations. So my question is, does this man implement church numerals without ever saying the phrase "church numerals".

    https://www.youtube.com/watch?v=9LfwxCIGbYo&list=PLgyU3jNA6VjRMB-LXXR9ZWcU3-GCzJPm0&index=6

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

    How did 4chan manage to edit the web page for the "Dub the Dew" campaign?

    Posted: 16 Apr 2019 03:31 PM PDT

    This video explains that they were able to edit the web page for everyone. How exactly did they manage to accomplish this?

    Wouldn't they need to be able to access the site via FTP/SCP?

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

    Can someone explain why this doesn't work? (Visual C++ 2013, setting a variable to a lambda in certain cases)

    Posted: 16 Apr 2019 01:34 PM PDT

    Edit:

    I think I've figured it out. Trying to set a std::function<void()> to a new value causes it to try and free up the previous value, if it's not zero. Allocating on the stack automatically zeroes; mallocing doesn't. By changing the malloc to a calloc (or better, as explained in the comments, by using new), I get the desired behaviour.


    #include <functional> struct my_struct { std::function<void()> func; }; int main() { my_struct my_array[10]; my_struct* malloc_array = (my_struct*)malloc(10 * sizeof(my_struct)); my_array[0].func = []{printf("hello\n"); }; malloc_array[0].func = []{ printf("hello\n"); }; // this causes a crash my_array[0].func(); getchar(); } 

    (this compiles with Visual C++ 2013. I don't know how to/if you can compile it with g++ because I think my version is too old).

    I'm trying to learn about lambdas and threadpools. I've got a basic threadpool working, but now I want - instead of hardcoding everything within the thread function - to be able to use a lambda as a parameter, which the thread function will then execute when required.

    But I'm hitting a problem because whenever I try to store a lambda in a struct, as above. It works fine if the struct (or an array of structs) is declared on the stack (as my_array is here), but not if I malloc an array (malloc_array).

    Can someone explain why this doesn't work? Am I overlooking something fundamental about the nature of lambdas that means they shouldn't be used in this fashion? If so, how can I achieve it (storing a lambda as a struct member for later calling).

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

    Sr. devs don't want to use foreign keys, I disagree. Am I wrong here?

    Posted: 16 Apr 2019 08:27 PM PDT

    At my company we are currently discussing a new database design for our applications. We are a small B2B consulting company, our applications rarely see more than 100 concurrent users as they are typically only accessed by a client admin or analyst. We use MS SQL Server 2017 for our RDBMS.

    The new design that our sr. devs have come up with involves splitting up data into separate databases, with common client information in one database, and then separate databases for each product in our suite (we have 3 distinct products). I have several issues with this design, one of them being that splitting up information this way takes away the ability to set foreign keys, and that it will be harder to maintain integrity in the long run. We process mainly transactional data, our largest product involves financial information.

    The sr. devs have been pretty hand-wavy toward my concerns, saying that they will just enforce integrity in the application. They also say that FKs will impact performance too much and that they aren't necessary. I understand that FKs do come with a slight performance impact, but I'm unsure how the application is supposed to handle integrity without having an impact on that side. The other thing is that our applications are serving a very low number of concurrent users, and is not real-time. Given the type of information we are dealing with, my opinion is that maintaining rock-sold integrity outweighs the slight performance impact of FKs in our case.

    Am I being crazy or unreasonable in this case? Is it common to use this type of database design in other enterprise applications?

    Thank you.

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

    Tools for sandboxing a project?

    Posted: 16 Apr 2019 07:35 PM PDT

    Before specifying the kind of software I want exactly, I'll just say what I've tried so far: Docker, Python Virtual Environments, AutoEnv, DirEnv.

    My ideal tool would allow me to create a new directory that thinks it is root. It is not able to see any of the packages I've installed through my package manager, it can't see any files outside itself besides whatever OS files it needs, etc. From the perspective of this new directory, it is the root folder of a freshly installed Linux (or whatever else) machine. It has all of the default environment variables, default installed software, etc etc etc. I want to be able to install whatever I want using a package manager and be able to have all of it gone when I delete the directory. I want the environment variables that I change to only effect that directory, not all the directories around it.

    With that said, here are the reasons why none of the 4 options I listed fit what I need:

    Docker does a lot more than what I need. It's proprietary, it has a high learning curve, etc. It's just too much.

    Python virtual environments are really close to what I want, but I need something language agnostic.

    AutoEnv and DirEnv I honestly haven't put too much thought into. Autoenv hasn't been updated in a year, and DirEnv, although it looks to be actively updated, still has a very small community.

    Does the tool I'm looking for actually exist, or am I the only one who gets massive headaches trying to manage their various environments?

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

    Help with printing multiple lines from text file with Regex in Ruby

    Posted: 16 Apr 2019 07:20 PM PDT

    Sorry if this is a simple question, but I'm new to programming and want to use it to make a simple interactive menu. I have a text file full of daily menus, and I want to use regex to search for the date, then print that line as well as the next 5 lines showing what will be served for breakfast, lunch, etc. that day. I'm trying to figure out how to print the line after a match, rather than just the line with a match.

    I have a loop to find the match, but I was thinking maybe I could find the position of the match, and then keep printing until it reaches a line with a date other than the one entered.

    Is there a simple way to just say print the next few lines? I feel like I might be overcomplicating this.

    Thanks for any tips or ideas!

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

    Ethical concerns, to fork or not to fork?

    Posted: 16 Apr 2019 03:33 PM PDT

    I'm not sure how to proceed here. Legally, I'm fine, who cares, do it. Ethically, eh, I want a second opinion.

    I'm working on a game. Who isn't, right? My target is going to be PC and Switch. Most engines that support both are HUGE. I found a quaint, small 2D engine that does what I need it to do, and it works for both.

    The guy who wrote it is a strong believer in -wall. Not -Wall. Function definitions default to a single return type that nearly never matches actual returns, there's no care taken to data integrity loss when passing numbers around (floats passed into functions expecting integers, etc), but when compiled with gcc, it works well enough, since GCC adds its own sanity checks. It won't compile on anything else due to the sheer number of otherwise-error warnings that are muted, and many gcc-specific shorthands incorporated into the code (the suffix literal d is use a lot, etc).

    I made it work with VC++ and Clang by fixing a TON of Bad Things.

    The sole dev who's written it is lax to incorporate fixes. The big complaint is 'they haven't synced github to their personal repo in a while'. They don't do sane commits, it's giant commits called 'syncing to version x.y.z'.

    It's all under MIT license, and while it needs an extreme amount of polishing, it does work. Since the dev responsible for it doesn't care much about incorporating back in efforts to fix issues... ethically, how bad is it to fork what is there, and run with it on my own? He also has a GUI editor, which I don't really care much about, and he can maintain that all he wants, its only the engine library mixed with it I would like to use as a basis and would fork.

    The other option I'm weighing is simply re-writing everything from the ground up. Its redoubling efforts on a lot of things, which means extra hours rewriting things that already work well enough, but an alternative here.

    Legally, either option works fine. Ethically, though, I'm torn on.

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

    I need a "Deep knowledge of some software design concepts" to advance in my job.

    Posted: 16 Apr 2019 05:41 AM PDT

    So I got a new boss about a year and a half ago and they instituted a job classification rubric. To advance higher in my job my boss said I needed a "Deep knowledge of some software design concepts" (this is an actual quote from the rubric).

    As a background i'm 3.5 years into my embedded programming job. I/we basically work with C programming and microchip pic micro controllers but have I have had to touch java/android/python as well. I also do not know a ton of OO programming as I came in with only assembly and c coding knowledge.

    Now to be fair I did go to my boss and ask them what they feel I lack and what I need to meet the said deep knowledge. What I got back was less then helpfully to be honest. My boss said to advance in my career I need to look at what set of competencies based on industries standers I meet and what I don't. Then my boss went on to say that part of reaching the next level is not being given all the answer.

    So i'm coming here hoping some one might be able to give me an idea of what I should know by now and what things I should look into.

    If you have any thoughts please let me know.

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

    printing some elements in a 2D list [Python]

    Posted: 16 Apr 2019 03:21 PM PDT

    Is there a way a can print just some elements in a 2d list?

    list1 =[ [1,2,3], [4,5,6], [7,8,9] ] 

    I know

    for i in range(len(list1)): for j in range(len(list1[i])): print(list1[i][j], end=' ') 

    would print the whole thing but what if I just wanted 1, 3, 4, 6, 7, and 9 to print? Would really appreciate any help.

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

    Does the Factory Method Pattern Make Unit Testing Easier?

    Posted: 16 Apr 2019 02:47 PM PDT

    Suppose we have the method X which constructs a variable (but specifiable) number of instances of class Blah; it then loops over them, calling the method Y of each. This is the behaviour of X.

    A unit test of method X would therefore want to verify that method Y is called on each constructed Blah. Consider then the following code:

    void X(int amount) { for (int i = 0; i < amount; i++) { new Blah().Y(); } } 

    How would a unit test verify that Y is called on the instances of Blah? If the instances cannot be mocked then I'm not sure it could.

    What then if X looked like this:

    void X(int amount, BlahFactory blahFactory) { for (int i = 0; i < amount; i++) { blahFactory.createBlah().Y(); } } 

    You could create a mock of BlahFactory with its createBlah method stubbed to return a mock of Blah. You could then inject the BlahFactory mock into X and verify that Y is called amount times. Thus we have tested the behaviour of X by making it rely on a factory.

    So does the Factory Method pattern make unit testing easier?

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

    Do you think it's a good idea to learn as many programming languages as possible or narrow down your focus?

    Posted: 16 Apr 2019 06:50 AM PDT

    I came across this article that suggests 'the more the better' when it comes to learning programming languages. Looking for any Reddit opinions, opposing and for on this.

    Here's the source: https://thorstenball.com/blog/2019/04/09/learn-more-programming-languages/

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

    Can someone tell me what these lines of code mean? if anything that is

    Posted: 16 Apr 2019 02:01 PM PDT

    Someone's fake-hacking me, but he sent this and i have no clue what this means so. any insight onto what this is? https://imgur.com/a/X9Ny0qh

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

    Coding a *fast* Monte Carlo tree search

    Posted: 16 Apr 2019 01:02 PM PDT

    I'm working on implementing the alpha zero algorithm in pytorch for the game English draughts.
    It was going well, but I scrapped it because my underlying implementation of the game/tree search was too slow, so training the network solely from self-play was not feasible because games would simply take too long to play out, even though they are basically random at first.
    I did rewrite the game engine with some success. It's still written in python but it uses bit boards and logic so its several times faster than my class based, array implementation.
    However, I cannot find any resources on how speed up the monte carlo tree search. The best I could find was this high level python code
    https://web.stanford.edu/\~surag/posts/alphazero.html
    Does anybody know of any book, webcouse, tutorial that I can look too?

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

    Multi-URL Stopwatch

    Posted: 16 Apr 2019 12:36 PM PDT

    I want to create a stopwatch that can be started by a specific page, but be on multiple pages. For example, if player 1 pressed start, the timer would obviously start and all the other players on different url addresses can see the same time the player 1 sees.

    Another question is how can I get the website to "time-out" after a certain period of time has crossed. For example, once the timer hits 15 mins, then the players cannot do anything on their page, essentially the game is over.

    Any help is super appreciated, thank you.

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

    I need to make videos only viewable on a site, it must not be downloaded/shared. How?

    Posted: 16 Apr 2019 12:31 PM PDT

    I need to show videos, doesnt matter if self hosted or on popular sites, but i need it to be unshareable and impossible to download.

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

    Ruby help

    Posted: 16 Apr 2019 12:17 PM PDT

    Update, this is what i have so far https://ibb.co/y45tjJp https://ibb.co/SBGGz9P

    Write a guessing game where the program selects a random number from 1 to 10 and the user gets three attempts to guess it. If, after a given attempt, the user does not guess correctly, display a hint using the following rules: * user's guess is 3 or more values away, display "cold" * user's guess is 2 away, display "warm" * user's guess is 1 away, display "hot" If the user guesses the right number in three attempts or less, print out a winning message; otherwise, print out a failure message. Repeat the entire process another nine times so that the user plays ten rounds. Keep track of the total number of rounds the user wins. After the tenth round, the program should print out how many of the ten rounds were won and how many were lost. Then, describe the skill level of the player as follows: * Players who win 7 or fewer rounds are rated as "amateurs" * Players who win 8 rounds are rated as "advanced" * Players who win 9 rounds are rated as "professionals" * Players who win all 10 rounds are rated as "hackers"

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

    Trying to make a program that would construct a rail track with a given number of pieces.

    Posted: 16 Apr 2019 08:26 AM PDT

    So my brother has this wooden rail track that you can assemble. There are different pieces that are either turning rails or just straight rails. I would like to make a program where I could input the number of the different rails I have, and have it generate a random combination so that I can assemble it in real life.

    I would also need to include the amount of room the algorithm can use, as my room isn't too big. The track would also have to connect with the very first rail to make it circular so that it loops around and there's no definite end.

    Here is an image of the rails I am talking about.

    https://www.google.com/search?q=brio+rails&rlz=1C1CHBF_en-GBGB804GB804&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjg3rnR9NThAhUIZ1AKHYLeDLIQ_AUIDygC&biw=1208&bih=921#imgrc=uXlOtfDbjzKJJM:

    I was thinking of representing the rails as vectors however I'm totally clueless about where to start. I would prefer to use Swift as my language since I'm only a junior developer and this is currently my main language, however, I would be comfortable trying a different one.

    If anyone could point me in the right direction with maybe a specific book, youtube video or algorithm I should look into, that would be great.

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

    How can I make a bot to generate random searches in a search engine?

    Posted: 16 Apr 2019 08:11 AM PDT

    So I have this pretty half-baked plan that I most definitely don't have the knowledge to pull off yet.

    So if people haven't heard of the search engine Ecosia it's a search engine that uses its profits to plant trees. Knowing search engines get revenue from ads on searches, could I theoretically make a bot to do a bunch of searches and generate money for the search engine? Would doing this actually have adverse effects? Would I also need to make it click on links? Assuming this plan would work at all, where do I start?

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

    In test driven development, is this correct: "no test failed = everything is successful"?

    Posted: 16 Apr 2019 05:31 AM PDT

    I've worked in software development for a while, but it was with old methodologies.

    I'm now working in a company where test driven development is the pattern used.

    We end up often with things where although tests run, the actual product doesn't work, even basic things such as it does not start up. I'm trying to figure out if it's the lack of tests, and the solution is to add more, or (and I'm sure you can sense my point of view) developers should understand what the code is doing and how it is used before making changes and relying on tests to tell them if the changes are right or not.

    I understand that tests are a more consistent way to validate things, however in practice, at least here, things go bad way too often. I'm not in a position to change things, I just want to see what the consensus is - is it to add more tests to the point that if there is no test failure, we know the product will work, or is that not the way?

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

    Kotlin from a Java Perspective (Final Year Comp Sci Survey)

    Posted: 16 Apr 2019 11:23 AM PDT

    Hello :) For my final year computer science project, I need Java programmers to suppose the potential effect of ten Kotlin programming language features on software development; this is to validate the detailed evaluation I've already done of these features.

    You don't need any prior Kotlin knowledge to partake in this survey. Only the requested information will be collected and analysed.

    These are the Kotlin features I want you to evaluate:

    1. Variable Declaration

    2. Default Non-Nullability

    3. Default Class-Inextensibility

    4. Default Non-Overridable Methods

    5. Default Function Parameters

    6. Native Function Types

    7. Class Properties

    8. Constructor in Class Header

    9. Range Expressions

    10. Operator Overloading.

    Here are code samples for each Kotlin feature, each with its parallel in Java: https://ufile.io/jl6ozgu7

    I want you to evaluate each Kotlin feature with regards to how it might affect the following, compared to the equivalent in Java:

    1. Understanding the Program (abbreviated as U): How does the piece of syntax and functionality affect the understanding of what the program is doing?
    2. Ease of Input (abbreviated as E): How easy is it to type the syntax, and does this affect the ease of moving the syntax and inputting other pieces of syntax?
    3. Robustness (abbreviated as R): How does the functionality protect the program from mistakes?

    I want you to rate each as having either a:

    • Positive effect (abbreviated as P)
    • Mixed effect (abbreviated as M)
    • Negative effect (abbreviated as N)
    • No effect (abbreviated as NE)

    I want you to reply to this post with a numbered list, with each item in the following format:

    U <abbreviated effect>, E <abbreviated effect>, R <abbreviated effect>

    The following is an example response:

    1. U N, E P, R NE
    2. U M, E M, R NE
    3. U P, E P, R M
    4. U M, E P, R P
    5. U M, E P, R M
    6. U P, E M, R NE
    7. U N, E P, R M
    8. U NE, E P, R M
    9. U N, E P, R M
    10. U P, E NE, R M

    I'll be quite grateful if you could do this for me :)

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

    Programming language suggestion. Need some help.

    Posted: 16 Apr 2019 09:41 AM PDT

    I don't have any knowledge on programming. I am a windows sysAdmin and the closest think i have done is PowerShell scripting. I would like to learn to program as i enjoy working in PowerShell. Rather than pick a language I have picked a project I would like to work on and would like recommendations on what would be a good fit for my goal.

    My project: pull user data from an API and host a simple webpage where i can search a user and get the data i need.

    What would be a good programming language to learn to be able to do this?

    Thanks!

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

    Conducting a SQL query in a mainframe database

    Posted: 16 Apr 2019 05:13 AM PDT

    Hi! I wanted to do a little java software where people could specify a few pre-determined settings to conduct a SQL query in an IBM DB2 I was going to do this by calling a Mainframe emulator program that allows automations, but this feels very inefficient, is there another way I could do this? Thanks for your help

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

    No comments:

    Post a Comment