• Breaking News

    Sunday, December 5, 2021

    What popular repository has the worst documentation? Ask Programming

    What popular repository has the worst documentation? Ask Programming


    What popular repository has the worst documentation?

    Posted: 05 Dec 2021 11:47 AM PST

    Any advice on a developer wanting to startup a company in a tough market?

    Posted: 05 Dec 2021 03:14 PM PST

    I've always wanted to make my own am and start my own company many, be my own boss. I've several great ideas that I've been developing for sometime. I'm currently thinking of switching jobs and thought to myself, maybe it's now or never to start on my own product? Thing is, while I believe in my product and think it's a great idea that others have told me they would really love if it existed, it's really more of a feature that doesn't currently exist in other apps in that class of apps. I looked into it and since it isn't a feature that is patentable, there's really nothing to stop any of the bigger dogs from simply taking my idea and, being more established, would de-incentivize anyone from using my app, being that the other apps are already developed and have more features than my app would have at the start. I'm thinking the only way to combat this is to not release until I have a solid product that can compete feature-wise with the others.

    So I don't know, I'm wondering if anyone has any advice for this kind of situation. Not sure I should even bother trying, and take that chance on myself and. work full time on my idea for 3-4 months or just give up and continue working for someone else. As an example, think of snapchat's features of temporary images/videos with screenshot notification, what's to stop another messaging application from ripping that off since that is the WHOLE reason people mainly use snap?

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

    Mouse color edit

    Posted: 05 Dec 2021 04:15 PM PST

    Hi I have a question. I have a mouse uRage Illuminated 00113722 which allows me to set 4 colors: red, blue, green and purple but I want white. I know that the mouse can glow white, but I don't know where can I set it/change it or what program to use to edit the mouse config. In the official drivers(uRage driver) this option doesn't exist.

    Thanks for help.

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

    Don't know why there is an error

    Posted: 05 Dec 2021 03:50 PM PST

    I have been stuck on this for hours why are all the BoatType variables showing errors and how do I fix this.

    CommodoreSailingClubMain.java

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.util.ArrayList;
    import java.util.Scanner;

    public class CommodoreSailingClubMain {

    public static void main(String[] args) {
    Scanner input=new Scanner(System.in);
    ArrayList<Boat> boatList=Boat.getBoatList();

    //If command line arguments are provided
    if(args.length!=0)
    {
    try {
    boatList=readCSVFileToList(args[0]);
    Boat.setBoatList(boatList);

    } catch (NumberFormatException e) {

    e.printStackTrace();
    }
    }
    else
    {
    try {
    //Read from FleetData.db
    boatList=readFleetData("C:\\Users\\asus\\FleetData.db");
    Boat.setBoatList(boatList);
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    System.out.println("File not found ! Exiting!");
    }
    }

    String userChoice="A"; //Initialize to any variable
    while(!userChoice.equalsIgnoreCase("X"))
    {
    System.out.print("Welcome to the Fleet Management System\r\n" +
    "--------------------------------------\r\n" +
    "\r\n" +
    "(P)rint, (A)dd, (R)emove, (E)xpense, e(X)it : ");

    userChoice=input.nextLine().toUpperCase();

    switch(userChoice)
    {
    case "P":
    System.out.println("Fleet report:");
    for(Boat boat:boatList)
    System.out.println(boat.toString());
    System.out.println("Total\t\t: Paid $"+Boat.getPaidTotal()+":Spent $"+Boat.getSpentTotal());
    break;
    case "A":
    System.out.print("Please enter the new boat CSV data : ");
    String [] strArr=input.nextLine().split(",");
    BoatType boatType=strArr[0].equalsIgnoreCase("POWER")?BoatType.POWER:BoatType.SAILING;
    Boat boat=new Boat(boatType, strArr[1], Integer.parseInt(strArr[2]), strArr[3], Double.parseDouble(strArr[4]), Double.parseDouble(strArr[5]), 0);
    boatList.add(boat);
    break;
    case "R":
    System.out.print("Which boat do you want to remove? : ");
    String boatname=input.nextLine();
    Boat boatToRTemove=null;
    boolean boatExists=false;
    for(Boat boatO:boatList)
    {
    if(boatO.getName().equalsIgnoreCase(boatname))
    {
    boatExists=true;
    boatToRTemove=boatO;
    }
    }
    if(!boatExists)
    System.out.println("Cannot find boat "+boatname);
    else
    boatList.remove(boatToRTemove);

    break;
    case "E":
    System.out.print("Which boat do you want to spend on? : ");
    boatname=input.nextLine();
    boatExists=false;
    double amt=0;
    Boat boatToUpdate=null;

    for(Boat boatO:boatList)
    {
    if(boatO.getName().equalsIgnoreCase(boatname))
    {
    boatExists=true;
    System.out.print("How much do you want to spend? : ");
    amt=input.nextDouble();
    input.nextLine();
    boatToUpdate=boatO;
    }
    }
    if(!boatExists)
    System.out.println("Cannot find boat "+boatname);
    else
    {
    if(boatToUpdate.checkExpense(boatToUpdate.getExpense()+amt))
    {
    boatList.remove(boatToUpdate);
    boatToUpdate.setExpense(boatToUpdate.getExpense()+amt);
    boatList.add(boatToUpdate);
    System.out.println("Expense authorized, $"+boatToUpdate.getExpense()+" spent.");
    }
    }
    break;
    case "X":
    System.out.println("Exiting the Fleet Management System");
    //Write to fleetdata.db
    writeSerializedFleetData(boatList);
    break;
    default:
    System.out.println("Invalid menu option, try again");
    }
    }

    }

    private static ArrayList<Boat> readCSVFileToList(String fileName) throws NumberFormatException
    {
    ArrayList<Boat> boatList=new ArrayList<>();
    //Initialize reader
    BufferedReader br=null;

    try {
    br = new BufferedReader(new FileReader(fileName));

    String line=null;

    while ((line = br.readLine()) != null) //returns a Boolean value
    {
    String [] lines= line.split(","); // use comma as separator
    BoatType boatType=lines[0].equalsIgnoreCase("POWER")?BoatType.POWER:BoatType.SAILING;
    Boat boat=new Boat(boatType, lines[1], Integer.parseInt(lines[2]), lines[3], Double.parseDouble(lines[4]), Double.parseDouble(lines[5]), 0);
    boatList.add(boat);
    }
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    return boatList;
    }

    private static ArrayList<Boat> readFleetData(String fileName) throws IOException, ClassNotFoundException
    {
    ArrayList<Boat> boatList=new ArrayList<>();
    try {
    FileInputStream fileIn = new FileInputStream(fileName);
    ObjectInputStream objectIn = new ObjectInputStream(fileIn);
    Object obj = null;
    while((obj = objectIn.readObject())!=null)
    {
    boatList.add((Boat)obj);
    }
    objectIn.close();
    } catch (Exception e) {
    // TODO Auto-generated catch block
    }

    return boatList;
    }

    private static void writeSerializedFleetData(ArrayList<Boat> boatList)
    {
    // write people to another file
    File secondPeopleFile = new File("C:\\Users\\asus\\FleetData.db");
    ObjectOutputStream writeObj = null;
    try
    {
    writeObj = new ObjectOutputStream(new FileOutputStream(secondPeopleFile));

    for(Boat boatO:boatList)
    {
    writeObj.writeObject(boatO);

    }
    writeObj.close();
    } catch (IOException e)
    {
    System.out.println("Problems writing to file");

    e.printStackTrace();
    }
    }

    }

    Boat.Java

    import java.io.Serializable;
    import java.util.ArrayList;

    public class Boat implements Serializable{

    private BoatType boatType;
    private String name;
    private int year;
    private String make;
    private double feet;
    private double purchasePrice;
    private double expense;
    private static ArrayList<Boat> boatList=new ArrayList<>();

    public Boat(BoatType boatType, String name, int year, String make, double feet, double purchasePrice,
    double expense) {
    super();
    this.boatType = boatType;
    this.name = name;
    this.year = year;
    this.make = make;
    this.feet = feet;
    this.purchasePrice = purchasePrice;
    this.expense = expense;
    }
    /**
    * @return the boatType
    */
    public BoatType getBoatType() {
    return boatType;
    }
    /**
    * @param boatType the boatType to set
    */
    public void setBoatType(BoatType boatType) {
    this.boatType = boatType;
    }
    /**
    * @return the name
    */
    public String getName() {
    return name;
    }
    /**
    * @param name the name to set
    */
    public void setName(String name) {
    this.name = name;
    }
    /**
    * @return the year
    */
    public int getYear() {
    return year;
    }
    /**
    * @param year the year to set
    */
    public void setYear(int year) {
    this.year = year;
    }
    /**
    * @return the make
    */
    public String getMake() {
    return make;
    }
    /**
    * @param make the make to set
    */
    public void setMake(String make) {
    this.make = make;
    }
    /**
    * @return the feet
    */
    public double getFeet() {
    return feet;
    }
    /**
    * @param feet the feet to set
    */
    public void setFeet(double feet) {
    this.feet = feet;
    }
    /**
    * @return the purchasePrice
    */
    public double getPurchasePrice() {
    return purchasePrice;
    }
    /**
    * @param purchasePrice the purchasePrice to set
    */
    public void setPurchasePrice(double purchasePrice) {
    this.purchasePrice = purchasePrice;
    }
    /**
    * @return the expense
    */
    public double getExpense() {
    return expense;
    }
    /**
    * @param expense the expense to set
    */
    public void setExpense(double expense) {
    this.expense = expense;
    }
    public static ArrayList<Boat> getBoatList() {
    return boatList;
    }
    public static void setBoatList(ArrayList<Boat> list) {
    boatList=list;
    }

    public static double getPaidTotal()
    {
    double paidTotal=0;

    for(Boat boat:boatList)
    {
    paidTotal=paidTotal+boat.getPurchasePrice();
    }
    return paidTotal;
    }
    public static double getSpentTotal()
    {
    double spentTotal=0;
    for(Boat boat:boatList)
    {
    spentTotal=spentTotal+boat.getExpense();
    }
    return spentTotal;
    }

    public boolean checkExpense(double amt)
    {
    if(this.getPurchasePrice()<amt)
    {
    System.out.println("Expense not permitted, only "+(this.getPurchasePrice()-this.getExpense())+" left to spend.");
    return false;
    }
    return true;
    }
    u/Override
    public String toString() {
    return boatType + " " + name + " "+ year + " " + make + " " + feet + "':Paid $"+ purchasePrice + ":Spent $" + expense ;
    }

    }

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

    What does it take to be successful as a neural network/machine learning programmer?

    Posted: 05 Dec 2021 02:04 PM PST

    Specifically, does one need a degree? What kind/level of degree is the minimum barrier to entry?

    For reference: I am a neurologist (MD) with no programming background. I was a Physiology major)

    Alternate question: How would you define success?

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

    Advice/help

    Posted: 05 Dec 2021 01:29 PM PST

    Hi people,

    I'm having a hard time programming. I'm currently taking a course and I'm feel stuck.

    I have a pretty good understanding about the concepts, and how everything works, but when it comes to write the code, I don't know what to do.

    Any advice?

    Thanks in advance.

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

    Homework help

    Posted: 05 Dec 2021 01:24 PM PST

    For my intro to Java final homework I have to create a program that reads a csv file. How do I take this csv file and input it into my code. I keep dragging it into my src file but when I run the program it says there is no such file or directory.

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

    How are url shortener services (ie, tinyurl) able to redirect urls dynamically?

    Posted: 05 Dec 2021 06:43 AM PST

    How do url shorteners create a redirection to some other url on the fly? For example, tinyurl can point to some arbitrary subdomain of theirs.

    The usecase is that you have a long domain like mylongdomainexample.com and using their services, you can generate a subdomain tinyurl.com/a1b2c3 that will redirect to mylongdomainexample.com

    So what is going on with the engineering behind tinyurl and other services like this? Presumably, they are messing with DNS in some sort of way, but this all my experiences with DNS have been manual and slow to propagate.

    Would love to know more about how they can create redirections like this on the fly. Thank you!

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

    Running a PowerShell script as admin on boot without confirmation

    Posted: 05 Dec 2021 12:28 PM PST

    I want to create a PowerShell script that runs on boot (Windows 7) and checks if a local DNS server is running - if the DNS server is running, it should change the DNS settings to the local DNS server. That works pretty well, but the annoying thing it it asks for a confirmation anytime.

    So is there a way to ask for a single confirmation that makes the script ALWAYS run as admin on boot without asking for further confirmations?

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

    MongoDB (Mongoose) database structure question.

    Posted: 05 Dec 2021 12:02 PM PST

    I'm currently learning about Mongoose and nodeJS. I have to Create a database in which the registrations for courses and the scores per course of students are saved. Each subject is also linked to a teacher. Think about the structure of the database. Make sure you can argue why you are connecting data via 'embed' or 'reference'. Also think about where you use indices and unique indices.

    The way I am currently thinking:

    • A student has multiple courses
    • A course has multiple students
    • A student has multiple scores on one course
    • A course has one teacher

    I tried making the following mongoose schemes:

    StudentSchema:

    const mongoose = require("mongoose"); const studentSchema = new mongoose.Schema({ name: { type: String, minLength: 3, trim: true, lowercase: true, validate: { validator: (value) => /^[a-z ]+$/.test(value), message: (props) => `${props.value} is not a valid name!` }, required: [ true, "Name is required" ] }, id: { type: Number, index: { unique: true }, min: [ 1, "ID must be greater than 0" ], required: [ true, "ID is required" ] }, courses : [ { type: mongoose.Schema.Types.ObjectId, ref: "Course" } ] }, { collection: "students" } ); module.exports = mongoose.model("Student", studentSchema ); 

    CourseSchema:

    const mongoose = require("mongoose"); const courseSchema = new mongoose.Schema({ title: { type: String, minLength: 3, trim:true, lowercase:true, validate: { validator: (value) => /^[a-z ]+$/.test(value), message: (props) => `${props.value} is not a valid course title` }, required: [true, "Course title is required"] }, teacher: { type: String, minLength: 3, trim: true, lowercase: true, validate: { validator: (value) => /^[a-z ]+$/.test(value), message: (props) => `${props.value} is not a valid teacher name` }, required: [true, "teacher is required"] }, student : { type: mongoose.Schema.Types.ObjectId, ref: "Student" } }, { collection: "courses" } ); module.exports = mongoose.model("Course", courseSchema ); 

    The problems I am currently facing:

    1. In the StudentSchema I am using an Id because I want 1,2,3,4 etc instead of randomly generated id from MongoDB. Is this the correct way to do it?
    2. How do I add scores to the database and where would I place it?
    submitted by /u/JensPanis
    [link] [comments]

    Is there a good way to learn the entire network?

    Posted: 05 Dec 2021 11:14 AM PST

    What I can do now is to exchange messages via socket communication using TCP

    But there's a lot I don't know about networking

    Is there a good way to learn about thing I dont know and networking?

    Thing I dont know(I want to learn)

    Why is it necessary to cross a NAT when making a tcp connection in a different LAN?

    (Probably to deliver information to the port, but if so, why is that?)

    Why is http used for websites?

    How a tcp connection keeps the connection trusted

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

    Code problem or code editor problem? Trying to create a sql query but it changes the color of my code..

    Posted: 05 Dec 2021 11:05 AM PST

    INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); 

    The problem arises when entering the values. How many columns and values can I enter? I have 98 but when I type too many values, all the code I have below that line turns gray red and green. The only two characters I am adding to the code editor are '?' and ',' because I will be using mysqli_stmt_bind_param to insert the actual values. When I delete a certain amount of the values, the colors go back to normal. So is this an error with my code telling me I can't enter that many values or is this just my code editor (atom) acting weird?

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

    Questions about file signatures or file headers

    Posted: 05 Dec 2021 09:50 AM PST

    1 . Is there a file format that doesn't have a file signature in famous file type?

    2 . Are there any public rules of file signature?

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

    Discovering if a program has COM?

    Posted: 05 Dec 2021 09:27 AM PST

    I also posted this in the AutoHotKey forum, but figured other programming gurus might have an answer for this....

    I am getting a little ahead of myself here, but I have an idea for a control I would like to make with AHK for another piece of software where it would control specific numeric controls in real time. I am just getting started in researching if this is possible, but I am unclear how to find out if I can get that kind of control from outside the program. The program has Lua scripting built in and many folks create their own tools for it, but always in program. The tool I wish to make would use an outside program to control the values, with AutoHotKey as the intermediary/Gui interface. This is a complicated idea, so the only part I am asking for help with at this time is how to determine if I can control from outside the program.

    I have been reading about interprocess communication and COM seems to be what I want to get that real time control. Is the the correct direction to research? How do you discover if this is possible with the original software? Anyways, thanks for looking, I hope someone can point me in the right direction.

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

    Applying for job, should I remove my hobby project in the resumé?

    Posted: 05 Dec 2021 08:24 AM PST

    Hi guys, as the title says I am applying for some programming jobs, and am about to do my bachelor thesis.

    Is it better to not include a link to my git if I have an unfinished project? (asteroids game but with crappy collision detection for when the ship is shooting at an asteroid). Dont have a menu yet, and the graphics is very simple. Imagine grey circles for the asteroids and a triangular looking ship which shoots red beams.

    Also this project was from my first Java course in school so the structure is not exactly the best and I am working on fixing the bugs and structural problems first.

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

    new localhost ip redirects to old localhost ip

    Posted: 05 Dec 2021 07:51 AM PST

    I recently switched ISP and therefore also router.So an old PC I used for practicing wordpress development changed IP.

    the old was 192.168.0.145 and the new is 192.168.1.103 , and when I try to open the wordpress site on the new IP it just hangs and I can see the browser tries to redirect to the old IP.

    I tried opening the site on the old PC through both 127.0.0.1 and 127.0.1.1 , but both try to redirect to the old IP too.

    I've tried adding these lines to wp_config.php: define('WP_HOME','192.168.1.103'); and define('WP_SITEURL','192.168.1.103');

    Anyone have any sort of hints? Or do I just try to salvage what I can and start over?

    Sorry if it's a simple beginner mistake.

    edit: I forgot to mention that I can ssh to the new IP just fine

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

    Implementing BFS for the "Number of islands problem" on Leetcode [PHP]. Can anyone spot the error in the algorithm?

    Posted: 05 Dec 2021 07:36 AM PST

    Solving this in PHP with the breadth-first search algorithm: https://leetcode.com/problems/number-of-islands/

    Not sure what's going wrong, but it's giving the wrong output. Any help?

    class Solution { /** * u/param String[][] $grid * u/return Integer */ function numIslands($grid) { $rowCount = count($grid); $colCount = count($grid[0]); $visited = [[]]; $islandCounter = 0; foreach($grid as $i => $row) { foreach($grid[$i] as $j => $col) { if($grid[$i][$j] == '1' && !$visited[$i][$j]) { $islandCounter++; //BFS $queue = []; $queue[] = $grid[$i][$j]; $rowCount = count($grid); $colCount = count($grid[0]); $visited[$i][$j] = true; while(!empty($queue)) { $directions = [ [0, -1], [0, 1], [-1, 0], [1, 0] ]; var_dump($queue[0]); array_shift($queue); foreach($directions as $direction) { $nextRow = $i + $direction[0]; $nextCol = $j + $direction[1]; if( ($nextRow < $rowCount) && ($nextCol < $colCount) && ($nextRow > 0) && ($nextCol > 0) && !$visited[$nextRow][$nextCol] && $grid[$nextRow][$nextCol] == '1') { $visited[$nextRow][$nextCol] = true; $queue[] = $grid[$nextRow][$nextCol]; } } } } } } return $islandCounter; } } 
    submitted by /u/ecky--ptang-zooboing
    [link] [comments]

    No comments:

    Post a Comment