• Breaking News

    Friday, January 17, 2020

    Why does everybody make fun of js? Ask Programming

    Why does everybody make fun of js? Ask Programming


    Why does everybody make fun of js?

    Posted: 17 Jan 2020 11:21 AM PST

    I'm 17, started programming two years ago and am working with WordPress as freelancer but I've been studying JavaScript and for now I want to learn Node, React and React Native to become a full stack. As you can guess, I don't know many programming concepts and I can't understand the reason for all this fun over JavaScript. Lastly, is it a good idea to start learning and work with JavaScript?

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

    Should I use a game engine?

    Posted: 17 Jan 2020 11:38 AM PST

    I want to make a 2d tile-based game, either a super mario bros or a pokemon kind of game. Any suggestions on whether to use a game engine or not. If so which one?

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

    Simplest way to work from multiple machines?

    Posted: 17 Jan 2020 03:14 AM PST

    Hello everyone! Absolute programming beginner here looking for a simple solution to the following problem:

     

    I have a private laptop, and a work laptop. I usually take the work laptop along to class because it's way lighter. What ends up happening is that I have to use good ol' USB sticks to transfer the source files from my work laptop to my private one every time because I need to keep working from home.

    I'd like to find a simple way to basically sync the entire current workspace folder from both machines, since I usually create a new project for every new exercise paper at class.

    editing this in: Basically the way I imagine it working best is: a. create new project on work laptop and write some code. b. save and maybe click sync/open a program/do something c. go to my laptop -> new project magically appears and I can continue working d. save and maybe click sync/open a program/do something e. work laptop -> new changes are now there as well.

     

    I currently use Eclipse for Java and VSCode with GCC for c++ (I'm open for other editors tbh)

    Now I asked around a bit and people suggested git. And I don't know whether it's just my lazyness or my beginner-ness but I thought git is way overkill for something that should be as simple as this.

    Any and all suggestions welcome. Thanks a lot in advance :)

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

    Websocket Feasibility for Real-Time Multiplayer JS/HTML Game

    Posted: 17 Jan 2020 04:02 PM PST

    How are websockets for real-time multiplayer games? I've got a system currently set up. My friend was testing my game earlier and he was receiving quite a bit of latency for a low amount of data. From server->client essentially 900ms to receive two JSON objects (player positioning). Whereas his messages from client->server almost immediately updated the game state on the server. Seems very slow and strange.

    My next question is how in the hell can I test this on my local machine. My modem does not allow hairpinning, even if it did doubt it would give accurate latency results. I need some other way to test the game from outside of my LAN. I tried a vpn but the websocket fails to establish. Anyone have any insight?

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

    How do I set up SublimeText and MingW to use external libraries?

    Posted: 17 Jan 2020 06:34 PM PST

    I'm new to programming. Can't figure out how to get my program to work because I can't get the compiler to use the library.

    Current process:

    1. Try to run finished code on SublimeText using the mingW compiler.

    2. I get the error "moveCar.c:3:9: fatal error: wiringPi.h: No such file or directory"

    I don't understand the process for installing libraries. What I did was:

    1. Install .zip from github.

    2. Extract the folder in it titled ______-master

    3. Put that folder into mingw/lib. I've also tried mingw/include.

    Please help. Been trying to fix for hours :((((

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

    Is it worth getting into ABAP for software development experience?

    Posted: 17 Jan 2020 05:13 PM PST

    I'm a Computer Science student who has the opportunity to work in an ABAP development job while studying CS. Is it worth it to get into it for having "software development" experience under the belt, so that when I finish my career I will have an easier time getting a job on something a bit more interesting?

    I guess the question would be: Is ABAP a good "gateway" programming language to get into software development? Or is nothing about ABAP transferable to other programming languages?

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

    Do exceptions work completely differently from c++ than java

    Posted: 17 Jan 2020 05:11 PM PST

    Like in java, if a catch block happens, no other code gets ran except a finally block. yet my catch block happens but then my code still breaks because of the lines after

     #include <iostream> #include<string> #include<vector> #include <cstring> #include <sstream> using namespace std; int main() { string hours; string minutes; int hour; int minute; try { string time; cout << "Enter a time in 24 hour format: "; getline(cin, time); int split = time.find(':'); cout << split; if(split !=1 && split !=2 && split != -1) { throw 99; } hours = time.substr(0, split); minutes = time.substr(split+1, time.length()); } catch(int x) { cout << "Invalid input" << endl; exit(0); } catch(...) { cout << "invalid entry" << endl; exit(0); } hour = stoi(hours); //Here because if the user types non numbers, this breaks minute = stoi(minutes); cout << hour << endl; cout << minute << endl; return 0; } 
    submitted by /u/ItsukiNakano
    [link] [comments]

    PHP - Is PDO enough to prevent mysql injections?

    Posted: 17 Jan 2020 04:20 PM PST

    Hello,

    i was wondering if PDO with prepared statements is enough to prevent any type of mysql injections?

    Besides PDO what else should i add to my code when imputing data that will improve my mysql security take?

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

    What is the orientation of ARKit's camera space?

    Posted: 17 Jan 2020 04:16 PM PST

    Client server security: how to?

    Posted: 17 Jan 2020 05:12 AM PST

    Hi,

    Disclaimer: please keep in mind that I am not really experienced in application security topics.

    I have been thinking about application security lately. Consider following abstract scenario:
    - server + client architecture
    - server stores some kind of userdata
    - user would have to do login with username / password, incl. remember me function
    - somehow server would have to identify user and send him only his data (user can modify this data)

    I thought of something like:
    - data transmission via SSL / TLS
    - server would authenticate user by transmission of username and PW at login
    - server would hash PW and check if valid
    - login state would be kept for certain time or client requests logout

    What I don't know is:
    - how to securely implement the user login and data transfer
    - something has to be stored somehow to implement the "remember me" function
    - how to implement this without someone else being able to use this for authentication

    TL;DR: How to make given scenario secure / Show me methods to secure a generic client server architecture without relying on third party authentication server.

    Thy

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

    IMAP session handling

    Posted: 17 Jan 2020 02:19 PM PST

    Hello. I've been writing a small application in C# that removes spam from an email account. I can't use built-in filtering as the spam originates from the provider and I can't switch providers, for reasons. Basically, my program knows the username and password, and, in a loop:

    1. connects to the IMAP server
    2. authenticates itself
    3. opens the inbox
    4. looks through the envelopes of all the messages in the inbox and sets the "seen" and "deleted" flags on messages that fit a pattern
    5. sends an "expunge" order
    6. disconnects
    7. sleeps for a few seconds

    It also has a web server that displays how many emails have been deleted and when, but that's secondary.

    I've tried to leave it running overnight on a VPS, but it is unreliable and crashes on a `NO` response from the server after some time:
    ```
    MailKit.Net.Imap.ImapCommandException: The IMAP server replied to the 'SELECT' command with a 'NO' response: Internal error.

    ```

    This appears to happen on opening the inbox. How long it takes, I do not know, because I haven't implemented logging yet. My questions are - is there something about the IMAP protocol that makes it shut out clients that reconnect and reauthenticate too often, is this the provider's doing, or is it actually an internal server error on their side that my app should ignore and retry later? Should I not disconnect after every deletion and only reconnect on dead connection exceptions?

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

    Need help understanding why my brute force program works

    Posted: 17 Jan 2020 01:58 PM PST

    So i am having to create a brute force program for simple equations (5x + 4y = 26 etc..). My solution works, but I am wondering why it works. When I add return at the end of the if statement then the print line does not execute after my for loops, which is what i want if a solution was found. However, when there is no return at the end of the if, the print line executes even if there was a solution found.

    Heres my code:

    public class BruteForce { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x1 = scan.nextInt(); int y1 = scan.nextInt(); int n1 = scan.nextInt(); int x2 = scan.nextInt(); int y2 = scan.nextInt(); int n2 = scan.nextInt(); for (int i = -10; i <=10; i++) { for (int h = -10; h <= 10; h++) { if (x1*i + y1*h == n1 && x2*i + y2*h == n2) { System.out.print(i + " " + h); return; } } } System.out.println("No solution"); } } 
    submitted by /u/JustAnotherButthole
    [link] [comments]

    C#: question about returning from a method that uses filestreams.

    Posted: 17 Jan 2020 01:20 PM PST

    If I have the following code:

    using (FileStream fs = File.Open(SomeFilePath, FileMode.Open, FileAccess.Read)) { using (StreamReader sr = new StreamReader(fs)) { //do stuff here return; } } 

    I know if I reach the } for its corresponding using, the stream for that using closes, but what happens if I return before reaching the } like I do in my example?

    Do the streams close or do they stay open?

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

    Cannot figure out how to get this JS flowchart library working in my React app

    Posted: 17 Jan 2020 01:18 PM PST

    https://github.com/dummerbd/react-flowy

    DEMO of the library.

    The setup looks pretty simple. Import the js and css, add two DOM nodes (a canvas and a "create-flowy"), and everything should work, right?

    To get this loaded in my react application, I copy/pasted the flowy.min.js and flowy.min.css files into my project. I also had to install jquery via npm. Then at the bottom of flowy.min.js, I added an "export default flowy" so that I could access the object in my react component.

    My react component looks like this:

    import React, {useEffect} from 'react'; import $ from 'jquery'; import flowy from './FlowyLibAssets/flowy.min.js'; import './flowy.min.css'; const FlowApp = props => { let {classes} = props; function onGrab(block){ // When the user grabs a block } function onRelease(){ // When the user releases a block } function onSnap(block, first, parent){ // When a block snaps with another one return true; } useEffect(() => { flowy($("#canvas"), onGrab, onRelease, onSnap, 4, 10); }); return ( <React.Fragment> <div className={'create-flowy'}>DRAG ME</div> <div id="canvas" style={{width: 500, height: 500, border: '1px solid black'}}></div> </React.Fragment> ); }; 

    This seems to almost do something. I can drag the block around, but the snapping into position is way off, the arrows between nodes aren't even close to correct, the tree stacks upside down instead of the way it does in the demo, etc etc. Is anyone able to get this library working in a POC similar to the demo in a react application?

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

    Best Way to Show Home Feed According to User Preference

    Posted: 17 Jan 2020 12:18 PM PST

    I'm working on a startup where I need to show data according to user preferences. I successfully collect what user likes, dislikes, whom to follow, and other stuff, etc... Now I need to show the user data or you can say the Home Feed like how Reddit, Twitter, Facebook, and other Social Media Platform shows.

    You may be saying that you get the posts of user preferences from the database and show it. But you see if a user following someone and the followee has uploaded three or four posts since the previous visit of my user. Now, this is where my first question arises.

    1. Should I show all the posts one after another or show a couple of posts then insert a couple of different follower posts and later show the remaining post?
    2. Another question if the above scenario is correct how do I randomize the user preferences and show them with proper pagination. Because I can't just load all the data to the website or app. This will cost me performance issues.

    Thanks for your time.

    submitted by /u/programming-nerd
    [link] [comments]

    Looking For Best JS Library To Build "Interactive Room" That Products Can Be Manipulated Within

    Posted: 17 Jan 2020 12:14 PM PST

    We're currently looking for the best JS Library that will allow us to add products to a canvas and then manipulate those products within the canvas. Think a furniture store application that allows users to pick different furniture items with specific dimensions, include on a canvas, and then configure the furniture within the room (drag, drop, rotate).

    I'm familiar with the more popular libraries like three.js, but I am curious if anyone has developed something similar to my example using a different library. Any insight is appreciated.

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

    Trying to automate writing the outputs of a quality control machine in Excel

    Posted: 17 Jan 2020 11:27 AM PST

    I'm using a Dinema Dsc Touch 7" Black Edition which is capable of exporting data in text format (eg. notepad document) when you plug a usb stick into it, but it takes way too long to move this data into excel. I'm manually inputting every data point which is also very time-consuming. I want it to automatically input the data point into a cell in excel as soon as the measurement is taken.

    I have tried connecting the machine using a USB A to USB B cable and while my laptop recognizes the device, it does not take inputs from it (unless all the data is being stored in some unknown location on my harddrive). I haven't tried using a double sided USB A cable yet, but I already ordered one from Amazon.

    The Dinema is configured to output to USB. I tried to see if I could configure excel to accept data from it, but of the available options (ex. From Database, From File etc.) none seem to be intended for this use case, or I just don't know how to use them. I tried creating a blank query and pasted in some code I found during a bout of research but I'm not a programmer so it was a bust.

    I'm running Windows 10 64-bit and Excel 16.0.12325.20280. Here are some pictures of the Dinema:

    The display after taking a measurement

    Ports on the side of the display

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

    How to rename files after fourth period

    Posted: 17 Jan 2020 11:08 AM PST

    How to mass rename files by removing everything after fourth period. All file names have different number of characters.

    Rename

    HI.5186.007.IDT_i7_2---IDT_i5_2.0H23_R1.fastq.gz

    HI.5186.007.IDT_i7_1---IDT_i5_1.BH2_R1.fastq.gz

    To: 0H23_R1.fastq.gz ; BH2_R1.fastq.gz

    thanks

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

    What language does arduino programming use?

    Posted: 17 Jan 2020 10:56 AM PST

    Hey, so I've heard that arduino is programmed using C and uses dictionaries, and uses python etc. What language does arduino programming actually use?

    Thanks guys, really appreciate the help

    submitted by /u/Aggressive-Zombie
    [link] [comments]

    Can someone provide a simple example of how hashing simplifies searching for something?

    Posted: 17 Jan 2020 06:12 AM PST

    Successful hashing algorithms allow the complexity of searching to be reduced from O(n), using linear search or even O(LogN), using Binary Search to nearly O(1), far faster than both for large N. In practice with an 80% load factor or less, Hashing for this purpose is wonderfully efficient.

    Source: https://www.quora.com/What-is-the-purpose-of-hashing-in-a-database

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

    Automating my job. Need help figuring out where to start

    Posted: 17 Jan 2020 09:34 AM PST

    The situation:

    I build nutrient plans for farms so that they stay within legal regulations. Company I work for has office 365 suite. Files are stored on Sharepoint in folder structure. Developing plans involves using government made tool for Silverlight. It's pretty bad, but currently the only way to make plans. A plan involves gathering data about farms, finding field size and dimensions, slopes, soil samples, location and a bunch of other properties. Then data about the owner, address contact and so on. Basically a bunch of data entry. Once all inputs are placed in program, generates a PDF. There is one option to generate XML, but it only contains contact info. If I want to go see how much fertilizer was put on a field in 2015? Go sort through PDF's for hours, manually write down all the info, calculate it and then I know how much was put on in 2015. If I want to know when our plan expires? Same deal

    I want a way to index this data to cut down on time spent scrolling through PDF's. So far it seems access will be my best option, though It seems like powerapps can possibly do it to? I've tried to dive headfirst into Access without much experience with office suite, and I feel as if it can definitely do what I''m hoping.

    I have not experience coding outside of HTML in the mid 2000's, and now it seems I may need to learn. I've figured out that these silverlight application save files are just XML's with a different file extension. Unfortunately, Access seems to not be able to deal with data in this XML structure. If I import, I actually do get all of my data. The problem is that it creates about 30 tables. From my research it seems that it's because the XML has nodes within nodes within nodes (I don't know what the terminology is, but heavy indentation, with sub categories of organization.) For instance,

    <SoilSamples> <SoilSample> <Description>Field 1a</Description> <SampleDate>2018-11-16T00:00:00</SampleDate> <P> <TestValue>14</TestValue> <LessThanInput>false</LessThanInput> </P> <K> <TestValue>240</TestValue> <LessThanInput>false</LessThanInput> </K> <PH> <TestValue>6.8</TestValue> <LessThanInput>false</LessThanInput> </PH> <OM> <TestValue>1.9</TestValue> <LessThanInput>false</LessThanInput> </OM> <AS> <TestValue>12</TestValue> <LessThanInput>false</LessThanInput> </AS> <CD> <TestValue>1.2</TestValue> <LessThanInput>false</LessThanInput> </CD> <CO> <TestValue>18</TestValue> <LessThanInput>false</LessThanInput> </CO> <CR> <TestValue>111</TestValue> <LessThanInput>false</LessThanInput> </CR> <CU> <TestValue>85</TestValue> <LessThanInput>false</LessThanInput> </CU> <HG> <TestValue>0.2</TestValue> <LessThanInput>false</LessThanInput> </HG> <MO> <TestValue>4</TestValue> <LessThanInput>false</LessThanInput> </MO> <NI> <TestValue>18</TestValue> <LessThanInput>false</LessThanInput> </NI> <PB> <TestValue>47</TestValue> <LessThanInput>false</LessThanInput> </PB> <SE> <TestValue>1.3</TestValue> <LessThanInput>false</LessThanInput> </SE> <ZN> <TestValue>220</TestValue> <LessThanInput>false</LessThanInput> </ZN> </SoilSample> </SoilSamples> 

    This Is one soil sample. It is under Farm>fieldnumber>fieldproperties>Fieldinputs>SoilSamples. Access displays each soil sample input as its own table. so <k> gets its own tables. There are multiple soil samples per field, multiple fields per farm, and multiple farms per plan. Ideally I would like to have this listed as a row in a table sorted by farm id, field id and date.

    I'm also not sure if I should be attempting to have one massive table for each plan, or multiple tables for different parts of plans. So soilsamples, farmer contact, farms, farmfields, fertilizer application ammounts (by date) all as their own tables relation ally connecting all of them together.

    My goal is to have a folder where I can drop an XML copy of a plan save file, and have Access parse it and update information into the database while keeping it's relational structure intact.

    Where I'm at

    I have no XLT with the XML. I decompiled the silverlight Application hoping to find an XLT. This I'm sure seems silly to someone experienced, but hey. No luck. I don't know c# so everything is basically guesswork. It seems as if there is an xml structured resx file, but I'm really not sure what that's for. It also seems like the XML is generated new each saves, I found the rules telling it how to generate or read the XML, but again being such a noob this doesn't help me much.

    I think the best way may be to learn some xlt and try making a transform file that can be applied to every plan as every plan is formatted with the same structure and tags, only inputs vary. It also seems possible to use VBA in access to do this parse the xml for data. What is my best option? Are there other options? Did I miss something simple? Should I learn c# or VBA? I'm down for anything, I just really don't know where to go from here.

    Any help is greatly appreciated! I can also provide a link to either the silverlight app or an entire dummy silverlight file/XML that i've been using if that would help.

    Thanks!

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

    jQuery - why isn't it working in this little snippet?

    Posted: 17 Jan 2020 08:49 AM PST

    I'm watching Traversy Media's video, link here (1min) - https://youtu.be/XsEnj-1hG2o?t=2759

    Here's my Code - https://imgur.com/a/4fPwqQt

    Would really appreciate some help, because I've rechecked multiple times now, starting to wonder if something else is the problem.

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

    GCC compiler in VS

    Posted: 17 Jan 2020 08:13 AM PST

    I'm a CS student that is starting to dive into SSH. I was wondering if there is a way to use GCC as your compiler in VS or VSC (and how to do it). Also, if you guys have any resources about ssh and how to get comfortable with it, I would really appreciate it!

    Bonus question: I'm starting my class on algorithms and data structures, so if you have resources about that, feel free to throw them here as well :)

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

    [SQL] Do i need to write NULL as x for each x column?

    Posted: 17 Jan 2020 04:04 AM PST

    I'm doing a

    insert to table1 select from table2

    where table1 and table2 have 3 common columns from about 200, where I want the last 197 columns to be NULL. Can i somehow bypass writing NULL as columnname, for each column?

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

    No comments:

    Post a Comment