• Breaking News

    Monday, September 7, 2020

    I only have a phone with that i can learn some programming, but ... how far could I really create something, what could I and what could I not do from there? Ask Programming

    I only have a phone with that i can learn some programming, but ... how far could I really create something, what could I and what could I not do from there? Ask Programming


    I only have a phone with that i can learn some programming, but ... how far could I really create something, what could I and what could I not do from there?

    Posted: 07 Sep 2020 08:10 PM PDT

    I am just beginning to learn some programming but I only have a phone, how far could I go with it? ... what are those things that I could not do and for which a laptop / pc would be necessary (I still think I do not know all the steps to develop a program)

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

    I want to store values of a 2D array into a 1D array in java.

    Posted: 07 Sep 2020 11:51 AM PDT

    I want to convert 2D coordinates into a 1D array. I've created an n by n 2D array. I then want to assign values of 1 through N into the 2D array sequentially from left to right, and then return the new 1D array.

    private static int[] to1Dcoords(int row, int column) { grid = new int[row][column]; //creates n by n grid int temp = 1; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[i].length; column++) { grid[row][column] = temp; temp++; } } int[] in1Dcoords = new int[grid.length()]; for (int i = 0; i < in1Dcoords.length; i++) { in1Dcoords[i] = } } 

    Any help would be much appreciated!

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

    Help in coding

    Posted: 07 Sep 2020 09:28 PM PDT

    Hi i need help in coding a java program that would input a 3 digit number, then determine and output a message if it is valid or in valid.

    These are the condition for the 3 digit number:

    First Digit: 1 or 9 Second Digit: 5-9 Third Digit: 1-9

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

    How do I make acronyms in python?

    Posted: 07 Sep 2020 06:30 PM PDT

    I'm in an intro cs class and need to make an acronym from a phrase. So far I've learned split() and some other basic syntax. I'm able to split the words in the phrase into a list, but don't know how to get the first letter of each word and combine them with the other first letters.

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

    Best cloud machine for remote programming?

    Posted: 07 Sep 2020 09:42 PM PDT

    There's been a lot of options for cloud gaming, and I'm wondering if there are similarly good options for cloud programming?

    Basically, I want a cloud Linux that I can remote into, which will give me the best visual quality and response time for reading/writing text, and won't break the bank.

    Anyone has suggestions?

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

    Try / Catch Block Help

    Posted: 07 Sep 2020 09:09 PM PDT

    In search of a better algorithm

    Posted: 07 Sep 2020 09:22 AM PDT

    I've written a python code to find the longest sorted alphabetical substring in a string of lower case characters. In case of ties, it returns the substring that comes first. E.g. for string 'ijkliabcd' it returns 'ijkl'.

    def substring(s): max_len = 0 max_i, max_j = (0, 1) i = 0 for j in range(1, len(s)): if s[j] < s[j-1] or j == len(s) -1: if j-i > max_len: max_len = j - i max_i, max_j = (i, j) i = j print("longest substring in alphabetical order is:", s[max_i:max_j]) 

    The time complexity of above algorithm is O(n) right? Is there an algorithm for this problem that is better than O(n).

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

    Whistle key fob

    Posted: 07 Sep 2020 05:54 PM PDT

    You know those keychain fobs where if you whistle within a certain vicinity, the fob will pick up the frequency and start playing a tone or beeping sound so you can find your keys?

    How can I find the code for this ive always wanted to know how it's done but never really knew what to search for

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

    Sending room code from server side to client side - Socket.io, Node.js

    Posted: 07 Sep 2020 08:20 AM PDT

    Newbie at web dev here. I am trying to create rooms with randomly generated codes using socket.io for users to connect with.

    My goal is to have the URL looking something like this when a user is connected into a room:

    localhost:3000/room/ABCDE

    Here is the post request code from the server.js file. When the user presses one of the two buttons (Create or Join). I use the data in the req parameter to hold onto the room code entered. /room here is the namespace.

    ``` app.post("/room", function(req,res){

    //Check to see if the req is authenticated if (req.isAuthenticated()){

    //Check if create button room button was pressed //If so create new room, push it to array and enter the room if (req.body.buttonType === "create"){ var newCode = generateRoomCode() activeRoomCodes.push(newCode); res.redirect("/room/"+newCode); } //Else check to see if the room already exists and is active then //Join the room else{ if (activeRoomCodes.includes(req.body.roomcode)){ res.redirect("/room/"+req.body.roomcode) } //Else prompt the user that the room doesn't exist and redirect them else{ //ALERT USER ROOM DOESN'T EXIST res.redirect("/room") } } 

    } }); ```

    Below is the socket.io connection on the server side, also in the server.js file

    ```

    //Create "/room" namespace and upon connection add user into the room io.of("/room").on("connection", function(socket){

    //Check if room exists and add user to room socket.on("joinRoom", function(room){ console.log(room) if(activeRoomCodes.includes(room)){ socket.join(room) io.of("/test").in(room).emit("newUser", "New User has joined "+ room) socket.emit("success", "You have successfully joined "+ room) console.log("Server Message: New User has joined "+room) } else{ socket.emit("err", "No room named "+room) }

    })

    // socket.disconnect()

    }) ```

    Finally here is the client side app.js file

    ``` const io = require("socket.io-client"); var socket = io.connect("http://localhost:3000/room")

    socket.emit("joinRoom", "<ROOM CODE GOES HERE>")

    socket.on("newUser", function(msg){ console.log(msg) })

    socket.on("err", function(msg){ console.log(msg) })

    socket.on("success", function(msg){ console.log(msg) }) ```

    I need to get the room code into the app.js file from the server.js file but I can't seem to figure out how. I got it to work by combining the code from client side and the server side into on file but I don't think that's a good idea. Any suggestions?

    Note: The form which takes in the user input to join a room and the create room button are on an EJS file

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

    How to create a python script to know the number of images added to a folder each day since last 3 day?

    Posted: 07 Sep 2020 05:59 AM PDT

    I am currently working as an intern in a company, and have very little experience in coding with python. I am working in a project with a team where we are going to use images of products for error detection using machine learning. So far the images are being collected till they reach upto 100k. So I as an intern have been asked to create a python script which will tell the number of images collected in last 3 days that is individually showing numbers of each day. Also how many images more needed to store to reach the goal of 100k. ( The images are being stored in a folder). Please help, how do I proceed with this, my attempts are leading me nowhere and I really need this to work.

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

    How do i save strings safely? C#

    Posted: 07 Sep 2020 02:23 PM PDT

    Hey there!

    I am making a program working with AccessTokens from twitch and i need a way to store those tokens/strings somewhat safely. Right now they are stored in plaintext as a txt.

    What would be an easy way to somewhat safely store those? I am using C# - WindowsForms

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

    How can i make dynamic spacing in Ada?

    Posted: 07 Sep 2020 02:09 PM PDT

    I'm trying to make dynamic spacing between different float values in Ada. The Aft=> aren't doing any good since the value that the float is written in front of, will grow and add an extra number (I.E 9 and 10).

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

    What is std::?

    Posted: 07 Sep 2020 01:46 PM PDT

    Hello, I keep seeing std:: and I really don't know what it means and when to use it?

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

    inverse of templating

    Posted: 07 Sep 2020 09:29 AM PDT

    templating is date + template -> text. do we have the opposite of this? namely text + template -> data?

    i understand that for short texts, we have regex. but for a longer file with repeated lines (e.g. an arbitrary number of data rows), this is not ideal. also kinda hostile to users.

    i suppose it can be done with a parser, using BNF as definition, and getting a syntax tree. is this a viable option? sounds rather complicated, a simpler definition would be desirable.

    can anyone give me a pointer, where to look?

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

    Error in C do while loop

    Posted: 07 Sep 2020 08:30 AM PDT

    #include<stdio.h>

    int main()

    {

    char another;

    int num;

    do

    {

    printf("Enter a number");

    scanf("%d",&num);

    printf("Square of %d is %d\n",num,num*num);

    printf("Want to enter another number y/n ");

    fflush(stdin);

    scanf("%c",&another);

    }while(another == 'y');

    return 0;

    }

    This program should ask for y or n after I enter the num, but as soon as I enter num, it displays the output as

    Enter a number6

    Square of 6 is 36

    Want to enter another number y/n

    and exits the program without even letting me enter y or n

    Same with this one, here I am using for loop

    #include<stdio.h>

    int main()

    {

    char another ='y';

    int num;

    for(;another=='y';)

    {

    printf("Enter a number:");

    scanf("%d",&num);

    printf("Square of %d is %d\n",num,num*num);

    printf("Want to enter another number y/n");

    fflush(stdin);

    scanf("%c",&another);

    }

    return 0;

    }

    submitted by /u/Any-Yoghurt3815
    [link] [comments]

    Declaration or statement expected

    Posted: 07 Sep 2020 11:49 AM PDT

    I am new coding and i am trying to code a small discord bot using discord.js.

    my code is:

    const Discord = require('discord.js');
    const client = new Discord.Client();

    const prefix = '-';

    const fs = require('fs');

    client.commands = new Discord.Collection();

    const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
    for(const file of commandFiles){
    const command = require(`./commands/${file}`);

    client.commands.set(command.name, command);
    }

    client.once('ready', () => {
    console.log('Ethereum Bot is now Online!');
    });

    client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;
    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if (command == 'youtube'){
    client.commands.get('youtube').execute(message, args);
    )};
    module.exports.run = (client, message, args) => {
    if(!message.member.hasPermission('MANAGE_CHANNELS')) return message.channel.send('You don\'t have permission to execute this command.');
    if(!args[0]) return message.channel.send('Please include a name for the channel after the command');
    message.guild.channel.create(args.slice(0).join(" "), {type: 'text'}), message.channel.send('Channel successfully created!');
    }
    module.exports.help = {
    name: 'createchannel'
    }

    and the problem comes up after the command youtube the )}; says that an declaration or statement is expected and i don't know what i have wrong.

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

    I have to create a program to send texts out for a company when someone has an appointment due the next day, where should I put this program and how should it be run?

    Posted: 07 Sep 2020 07:04 AM PDT

    So I have to create a program for a doctors office that will send a reminder text to the incoming person that their appointment is the next day.

    I will be using Python for this program but writing the code part is not the issue, I have checked out both the doctors office's API and an SMS messaging API and have a fair idea about how I will write the code.

    However my issue is that I don't know what the best thing is to do with the code once I have it finished, should I turn it into a Python executable and store it on one of the computers in the office and have a task scheduler run it once every day, and if so, what computer do I choose? Or should I implement it through their website and have them press a button everyday to run the program?

    Sorry if these are stupid questions but I just need a bit of guidance.

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

    Converting a Ruby code to java. Can someone explain the below code and how hashes work in ruby? I am concerned about what does the JASON.parse return and how is token's value getting extracted using the square braces? What will be the java alternative for this?

    Posted: 07 Sep 2020 04:05 AM PDT

    token=JSON.parse(response)['data'] ['tokenRespPayload'] ['token']

    hasPermission=JSON.parse(response)['data'] ['userdetails'] ['permission'].include? 'MODIFY_USER'

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

    How many concurrent TCP connections can a server handle ?

    Posted: 07 Sep 2020 02:15 AM PDT

    When an HTTP server starts up it creates a new socket, binds itself to an address:port pair and then listens for new connections on it. For all the requests it gets, it establishes a new socket. And since there are only 65535 TCP ports, it means that a server cannot have more than that amount of concurrent connections .

    How can then some website serve millions of request every minute (considering there's one single server)?

    Or are my assumptions wrong here ?

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

    Stuck in a project with Spring security with no knowledge of Spring

    Posted: 07 Sep 2020 05:45 AM PDT

    Hi, Im a Developer Specialised on Frontend with JS, JAVA etc but lately while the webpage i was doing for my company didnt recieve any new offer they had put me on a new project with Spring Security and im struggling to understand the basics of it as i never worked with more than a super basic level of Spring. The technical team leader doesnt really understand that im struggling even if im telling him everyday and its starting to take a toll on me. He wants me to migrate classes and the whole service thing to do it as a request based Pre authentification or smth and i dont even entirely understand the interaction between java and spring at that level and also i dont have full access to the java code. Any tips on how to learn the basics for this? or atleast how to tell him that its really not my profile? idk if this is the correct sub but thanks in advance

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

    How would I implement a Python Flask app into a PHP website on the same server?

    Posted: 07 Sep 2020 12:17 AM PDT

    I'm helping out a company which has a website with customer service built in PHP. I need to make a part of the website, which will only be used by employees to manage stuff and make work easier.

    The problem is I never worked with PHP, nor am I an experienced web developer. So I decided to go with Flask in Python, as I'm most familiar with it. I didn't have a chance to talk to their programmer yet(he's very buisy).

    Any ideas how this would work? The website runs on a AWS server as far as I know.

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

    I want to create a program in Java. Please help me with an approach.

    Posted: 07 Sep 2020 04:01 AM PDT

    I need to create a program which does following

    1) There is a third party library which does some processing when I provide a set of input (3-4 parameters).

    2) I have list of 10K input parameter sets (I need to invoke the above mentioned TP library with each input set)

    3) I need to have parallel execution so that 8 input sets are processed in parallel at any given time.

    4) Also input sets numbered 1-1000 need to be executed first before I can start inputs numbered 1000-2000 and so on for next 8K input sets

    I dont have much idea about concurrency in Java. So kindly help me with approach I should take and what features Java provides to solve this problem. I would be using Java 8 (that is a mandate for me)

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

    Is it possible to code a ping spoofer for valorant?

    Posted: 07 Sep 2020 12:30 PM PDT

    I want to make it look like I have 0 ping is that possible?

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

    No comments:

    Post a Comment