• Breaking News

    Sunday, September 22, 2019

    Where to learn more about stdin / stdout / stderr, various types of shells, SIGs, etc? Ask Programming

    Where to learn more about stdin / stdout / stderr, various types of shells, SIGs, etc? Ask Programming


    Where to learn more about stdin / stdout / stderr, various types of shells, SIGs, etc?

    Posted: 22 Sep 2019 05:00 PM PDT

    There seem to be some common traits among all OSs, of which I've "deduced" a few ad-hoc, like the convention of a program returning 0 as success, how environment scope works when invoking subshells, how strings with spaces function as a parameter each, etc. Where can I learn this stuff in a more structured manner?

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

    Advice on how to create a mobile application for a social media platform?

    Posted: 22 Sep 2019 09:04 PM PDT

    So I've been developing a social media platform using a combination of WordPress, because it gave me a good starting position and was open source; PHP for managing user information; and a large amount of HTML. Recently I had an idea to create a mobile application for the platform. While I've had some experience working with Android Studio, I am completely lost on how to proceed with such a task. Would anyone happen to have any advice on how I could start on such a project, or would the use of WordPress make this too difficult? Thanks for your time.

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

    ELI5: What does ‘implementation’ and ‘initialisation’ mean in data structures?

    Posted: 22 Sep 2019 08:10 PM PDT

    Equipment management system

    Posted: 22 Sep 2019 05:46 PM PDT

    I am currently interning at an engineering firm, and as a peripheral task, I was asked to come out with an Equipment management systems. This system has to be able to track which equipment has been serviced, and when, and its next date to be serviced, and date of arrival... general sorts of data.

    I have learnt C and python before, however, it was all in school, so I did not have a chance to actually apply it. I was tasked by the IT department to do this and my superiors felt it would be good opportunity for me to learn. I was asked to use mySQL and I believe I have to pick up JS as it would eventually be on a web application.

    Any input is appreciated! Thanks

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

    Why does this work in Java, but on paper it never satisfies the loop condition?

    Posted: 22 Sep 2019 07:19 AM PDT

    I am looking to add the digits of an entire number e.g. input 42, result is 6.

    Why on earth does this code work in java, but on paper you get like 6.66..and never come close, or never get six. Every time you divide by ten, you don't get down to 0, you get a smaller and smaller decimal.

    import java.util.Scanner; public class Exercise33 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Input an integer: "); long n = input.nextLong(); System.out.println("The sum of the digits is: " + sumDigits(n)); } //I wrote this on paper, and if I input 42 it's not 6, it's 6.66 etc... public static int sumDigits(long n) { int sum = 0; while (n != 0) { sum += n % 10; n /= 10; } return sum; } } 
    submitted by /u/ThisSoFrustrating
    [link] [comments]

    Is there a difference between 0xAAAA and 1xAAAA?

    Posted: 22 Sep 2019 08:01 PM PDT

    I noticed that heximals sometimes start with 0x. Would it be different if it was 1x?

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

    Invalid object name 'Table'. - C# MS SQL .NET

    Posted: 22 Sep 2019 04:24 AM PDT

    I made a website in visual studio using the .NET framework and MS SQL. It works fine locally, however the published version does not work.

    Live Site: https://dbtestnp.azurewebsites.net/WebForm1.aspx

    Looking around on stack overflow, people suggest for me to connect to the server using Microsoft SQL Server Management Studio.

    Stack Overflow question (not mine): https://stackoverflow.com/a/4993066

    I'm unsure of my server name, however another stack overflow posting showed me how to find it.

    Find Server Name: https://stackoverflow.com/a/18765207

    Here's my code for finding the server name:

    SqlConnection ha = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); ha.Open(); string check = "select @@servername"; SqlCommand test = new SqlCommand(check, ha); string res = test.ExecuteScalar().ToString(); System.Diagnostics.Debug.WriteLine("look here"); System.Diagnostics.Debug.WriteLine(res); ha.Close(); 

    And the result:

    look here DESKTOP-DA0IK1L\LOCALDB#B511F18B 

    I'm unable to connect to this in SQL management studio.

    I don't know if the database is on the published site, and unsure of how to check.

    Not too sure how I'm meant to solve this on my own either.

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

    Is a for loop within a while loop considered a nested loop.

    Posted: 22 Sep 2019 04:43 PM PDT

    Beginner here, I was asked to complete an assignment that must use a nested loop. I was able to do it using a for loop inside a while loop and wanted to know if it was valid before I could submit it.

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

    How can I create a custom function in R, that gives me a cumulative sum of a vector?

    Posted: 22 Sep 2019 09:25 AM PDT

    As the topic states, how do I create a custom function in R, that gives me a cumulative sum for a vector? I know R has the function cumsum, but I'm trying to create a custom one for myself with a for loop, with which I'm struggling with.

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

    Need a good keyboard recommendation!

    Posted: 22 Sep 2019 12:59 PM PDT

    Curious if anyone could suggest a good keyboard for me to get. I've been using a wireless Logitech for the last 3 years but working as a programmer I have not only destroyed it but also noticed pain in my wrists getting progressively worst (I did start wearing wrist supports a few months ago and it has definitely helped) but it's time to bite the bullet and get a keyboard that will help me not ruin my wrists and provide some better support.

    Would love to hear what others are using who have experienced similar issues

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

    Do you need a Map to clone a regular Linked List in Java?

    Posted: 22 Sep 2019 12:58 PM PDT

    So, in the classic problem of Clone a Linked List with a random pointer, the most straightforward approach means using a map. This problem just means that there is totally random pointer in the node that can point anywhere. The code for that would look like:

    public class Solution { public RandomListNode copyRandomList(RandomListNode head) { if (head == null) { return null; } final Map<RandomListNode, RandomListNode> map = new HashMap<RandomListNode, RandomListNode>(); RandomListNode cur = head; while(cur != null) { map.put(cur, new RandomListNode(cur.label)); cur = cur.next; } for (Map.Entry<RandomListNode, RandomListNode> entry : map.entrySet()) { final RandomListNode newNode = entry.getValue(); newNode.next = map.get(entry.getKey().next); newNode.random = map.get(entry.getKey().random); } return map.get(head); } } 

    As you can see, a map comes in handy to solve that. Likewise, a map is also used when cloning a graph. You do something very similar, except with just a DFS to connect all neighbors as well.

    My question is: If it's just a regular Linked List (no random pointer), would you still use a map?

    Or would there just be a simple approach using purely iteration to do that, without allocating any extra space?

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

    Unknown Programming

    Posted: 22 Sep 2019 12:40 PM PDT

    https://gyazo.com/cde192f8e2cd555d9d0eab448f232e43

    I dont know what this language/program is. Anyone know what it is?

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

    Is it bad for me to forget all the languages I’m proficient in?

    Posted: 22 Sep 2019 10:01 AM PDT

    I forget what language I might've done a thing in, i forget about which syntax I need to use st this very moment all the time, and worst of all- I forget there are many languages I've programmed proficiently in.

    Does this mean that i really just don't know any of them well? Or that I'm bad at compartmentalizing mentally?

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

    Please help me with testing on iPads

    Posted: 22 Sep 2019 09:24 AM PDT

    I am developing the following Website as a fan project for a video game:

    https://edave64.github.io/Doki-Doki-Dialog-Generator/release/

    I have been told by multiple users that it fails to load on iPads (iPad Pro 2015, iPad 5th generation) on iOS 12.4.1.

    Safari seems to just show a screen with the message "A problem repeatedly occured on https://edave64.github.io/Doki-Doki-Dialog-Generator/release/", with no further details. And neither of them has a Mac or the knowledge on how to debug a website.

    Could somebody with matching device or experience investigate and tell me what the problem could be?

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

    Postfix Evaluator

    Posted: 22 Sep 2019 09:22 AM PDT

    I want to create a Postfix Evaluator that works with multidigits and decimal numbers. The program works with multidigits but it does not with decimals. How can I make this? I have used the infix expression: "10 + 20 * ( 50 / 3 ) + 4" , which in postfix is "10 20 50 3 / * + 4 +". As a result I have got 347.33333333333337, which is correct. I just need the evaluator to work with decimal numbers.

    public class EvaluarExpresion { public double evaluaExpresion (String postfija) { MyStack<Double> stack = new MyStack<Double>(); //String postfija= expresionPostFijo(); for(int i = 0; i < postfija.length(); i++) { char c = postfija.charAt(i); if(c == ' ') { continue; }else if(Character.isDigit(c)) { int n = 0; while(Character.isDigit(c)) { n = n*10 + (int)(c-'0'); i++; c = postfija.charAt(i); } i--; stack.push((double) n); } else { Double val1 = stack.pop(); Double val2 = stack.pop(); switch(c) { case '+': stack.push(val2+val1); break; case '-': stack.push(val2- val1); break; case '/': stack.push(val2/val1); break; case '*': stack.push(val2*val1); break; case '^': stack.push(Math.pow(val2, val1)); break; } } } return stack.pop(); } public static void main(String[] args) { // This is an example of an infix expression String dato = "10 + 20 * ( 50 / 3 ) + 4"; //The expression provided below is a postfix expression System.out.println(a.evaluaExpresion("10 20 50 3 / * + 4 +")); //The result is 347.33333333333337 which is correct } 

    }

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

    for loops in js (why does i have to = 0)

    Posted: 22 Sep 2019 02:09 AM PDT

    im trying to write a for loop through every element in an array starting from the last one, but i dont understand why i has to equal 0 when the last element of the array would be array[0]?

    example:

    for(let i = array.length - 1; i = 0; i--)

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

    Qt 4.8 nested containers in signal

    Posted: 22 Sep 2019 02:13 AM PDT

    Hi,

    I have thread that communicates with main thread using queued signals periodically to receive new data and to publish data (3 signals to publish 3 to receive).

    Signal / slot signatures are one of these: void readComplete1(QVector<QVector<double> >); //data void readComplete2(QList<QList<int> >); //data2 void receive1(data) ; void receive2(data2) ;

    To send:

    ThreadA MyClass1::updateData(data) > MyClass2::updateData(data) > MyCommClass::updateData(data) { emit sendData(data); } > ThreadB receive1(data) { m_data = data; }

    To receive:

    ThreadB periodicreadFunction(data) { emit readComplete1(data) ;} > ThreadA MyCommClass::receiveData(data) > MyClass1::dataUpdated(data) { data is set to multiple int variables}

    This setup works. My question is can i use references to pass data to functions and signal instead of value? Is it correct to assume my current code creates many copies of data along the way to its destination? And do i risk data loss with references if signal is sent and data vector is right after that modified?

    data is created on ThreadB by creating qvector on stack and adding 3 vectors to it and same for data2 with QList.

    On ThreadA data is created similarly but instead of adding containers temp container is created and data added in for loop.

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

    Can I ask for a BIG favor here?

    Posted: 22 Sep 2019 10:59 AM PDT

    Can someone do a great favor and help with a long awaited request?

    Can someone with some create a C# interface for this C++ Library to handle HEIC containers using Pinvoke or similar methods and publish it either on GitHub or as a NuGet (preferably both) ?

    Goal: I need it to decode/encode image collections + metadata + thumbnails in a C# program

    thank you you guys xxx

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

    What's the best way to automate a script to run each day, sending an email with its results?

    Posted: 22 Sep 2019 04:59 AM PDT

    I'm curious about both the cron part and the email part.

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

    Why doesn't the code below work?

    Posted: 22 Sep 2019 04:27 AM PDT

    The prompt command will work if you remove all the if and else if statements but won't show up if the aforementioned code isn't greyed out.

    Just wondering what's going wrong as the console told me "Unexpected token <" but I thought that's how you do this particular operator of being less than?

    let year = prompt("What year is it?");

    if (Number(year) >= 0 && < 2000) {

    alert("early!"); 

    } else if (Number(year) >= 2000 && < 3000) {

    alert("modern age!"); 

    } else if (Number(year) >= 3000 {

    alert("in the future!!"); 

    };

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

    Making a clickable rendered line in Unity

    Posted: 22 Sep 2019 02:57 AM PDT

    So I'm trying to build a small game to familiarize myself with Unity and get better at coding and I've ran into a problem that I can't seem to figure out on my own. I already asked in the Unity3d subreddit but the post got buried. For my competence level I took some courses in Java/C# but am far from a professional. I'm currently trying to branch out to game engines to see if it might be a fun hobby.

    My project is turn based and should work by the player inputting a number of orders (e.g: move here, shoot there) and then running those orders simultaneously with an opponent, much like Frozen Synapse but with the added ability to aim. I am now working on the basic inputs and now have a very simple system that allows movement, waypoint setting and a line renderer that draws a line between those waypoints as a sort of predictive path.

    What I now want to implement is the ability to allow the player to click anywhere along the predicted path to add an 'action' (currently the only existing action is shooting) to that point in the path. This way the player can add orders like 'move there, while moving, shoot in this direction'. I'm trying to do this by having the path be clickable, and if the path is clicked an 'event box' is added to the path which allows the player to input the necessary information (shooting direction, weapon type etc). If the player lets the turn run and his unit reaches the 'event box', the actual event can then play.

    I'm currently trying to use raycasting to check if the mouse is on the rendered line when the right button is clicked, however, I believe the line needs to have a collider for this to work. I googled how to add a collidor to a rendered line and it seemed most people approximate a line with box colliders, which is not ideal since the line could be curved. Then I found this post (https://forum.unity.com/threads/generating-meshcollider-via-scripting-for-linerenderer.644929/) about using LineRenderer.BakeMesh() to add a meshcollider to the line. However, it's not very clear and I'm afraid I don't actually have an idea what I'm doing. I know the basics of meshes and colliders like that they're a bunch of vertices that are used to detect collisions and such but I'm not sure what I'm actually doing when using this method. Sadly, documentation on the internet on this specific function seems very sparse and often assumes you already have some knowledge about colliders and meshes, leading me here.

    I'm not really sure if I'm even in the right place to ask here, but since it's programming related I figured I should give it a shot. If someone could give me a bit of an explanation on this function and a recommendation if I'm even on the right track I would be very happy.

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

    Selfmade popups on every page load/refresh?

    Posted: 22 Sep 2019 01:18 AM PDT

    Hello.

    I am trying to learn German vocabulary but lack consistency... and I definitely spend too much time on reddit.

    So today I came up with an idea that it would be great to have a pop-up window (containing a German word or a sentence) appear each time I click on a reddit post or, better yet, each time I visit a new page or refresh my browser (Mozilla). This would definitely force me to spend more time learning and less time surfing the net.

    I have a basis knowledge of JS and PHP so I know how to set up a database where I could enter all the vocabulary I'd like to appear as pop-ups and to turn it later into some form of a multiple-choice-question window.

    What I don't know, however, is:

    1. what I need to do to to affect the behaviour of a browser each time I open a new window or refresh a page

    and

    1. what I need to make the browser read PHP code.

    Any advice would be greatly appreciated.

    And, of course, if there is a software or an add-on that could do it without the need to program it all from the scratch, I'd be most grateful to learn about it.

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

    Using JWT Signature to blacklist token

    Posted: 22 Sep 2019 12:48 AM PDT

    Is it recommended to use the signature part of the JWT token to blacklist revoked tokens? The reason is I want to fix the size of the identifier I store for the revoked token in my database. In future, I might add more data to my JWT payload, and I don't have any unique JTI in the token.

    The signing algorithm I use is HS256.

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

    No comments:

    Post a Comment