• Breaking News

    Monday, February 1, 2021

    Finally finished the code to block a specific artist on my Stream so that when the artists I follow repost that artist's track, it will be removed. But the ram seems like hell, does anyone know how to optimize it? Ask Programming

    Finally finished the code to block a specific artist on my Stream so that when the artists I follow repost that artist's track, it will be removed. But the ram seems like hell, does anyone know how to optimize it? Ask Programming


    Finally finished the code to block a specific artist on my Stream so that when the artists I follow repost that artist's track, it will be removed. But the ram seems like hell, does anyone know how to optimize it?

    Posted: 01 Feb 2021 08:43 PM PST

    https://ibb.co/vv04gCq

    your_js_file.js

    let bad_name_arr = ["Future House Music", "Strange Fruits", "Future House Cloud","bitbird","Anjunadeep","Future Generation","Musical Freedom"]; let elements; let element_text; let bad_name; document.addEventListener('scroll', init, false); function init() { // document.querySelector(css query here) selects elements based on css syntax console.log('Function called') elements = document.querySelectorAll('.sound__body'); //.userStreamItem, .soundList__item, [temp not these two because we want to remove artist's reposted track, but not track artist reposts] for (let element of elements) { console.log('Getting element text') element_text = element.innerText; for (let i = 0; i < bad_name_arr.length; i++) { bad_name = bad_name_arr[i]; if (element_text.includes(bad_name)) { console.log('Removing element') element.hidden = true; element.remove() //node.remove() break; } } } } 
    submitted by /u/hwpcspr
    [link] [comments]

    Uber-like coding platform I can join

    Posted: 01 Feb 2021 06:43 AM PST

    I'm looking for a platform I can join where I can sign up, sign a blanket non-disclosure agreement, then take a coding or other related task (code review, testing) from a central backlog. I work on it, submit my results and pick a new task. My work will appear on a backlog for someone else to review/test etc.

    I'm thinking an Uber-like situation where I choose when I code and for how long. Of course task providers can set deadlines, bid for the highest rated developers etc. I'd really hope this exists. Does it? If not, should it/ could it?

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

    ELI5: Database

    Posted: 01 Feb 2021 07:01 PM PST

    I've been teaching myself web development for a while. No formal CS / SE education. Database stuff is easily my weak area.

    I've read a lot about relational databases and document databases etc. Been wanting to play around with MongoDB. I'm comfortable with a lot of the basic ideas just need to dive in and build something.

    Here's my question though. What does a database look like in context of the file system? One, potentially poor example is a MS Access database, where the whole thing is a file on disk. I get the sense that this isn't how a "real" database works.

    If I wanted to create a database on my laptop just to play around with, where would I even start? I understand it's really pointless unless it's on a server etc.

    A colleague recently showed me how to use Excel Power Query to connect to a SQL database at work. That just needed a server name and a "Database" which was the name of the db I guess. I don't know what that name really means... is it a file name or something else???

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

    I'm having trouble with Aligning/Formatting my Output in C++. Anyone Help Plz

    Posted: 01 Feb 2021 07:01 PM PST

    Can fix my code or give me the correct function for formatting

    http://pastie.org/p/5PVfmGH9fCq9LiP0Ol34nS

    (LINK expires in 24hrs btw)

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

    How to create many elite proxies on one computer(windows)?

    Posted: 01 Feb 2021 05:48 PM PST

    Do I need Docker?

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

    Advice about ready-made React/Angular themes

    Posted: 01 Feb 2021 05:33 AM PST

    Hi everyone,

    Because I was never too much into front-end development and did only the necessary I decided to buy a ready-made Metronic React/Angular theme.

    How do the ready-made themese work tho? Can I connect it to my own backend and database such as Node.JS/MongoDB? Would that prove difficult bearing in mind the theme was already made and would it give lots of errors?

    How do I approach it bearing in mind that I need to implement a text-editor function and qr generator? For the qr generator I believe there is an npm package which was working with React tho Im not sure on this.

    Also, how do I create the text editor? It's quite possible with javascript functions but are there any other ways? For example, in the html version of this theme there is a tool called WYSIWYG which is a text editor but I cannot see that in the React version

    How do I approach authentication too? I was considering implementing Firebase but then again I don't want to force the users to use google and upload the database there.

    Any brainstorming would be appreciated really as I really am not sure how to solve that many problems and there would be probably more coming up.

    Thanks in advance.

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

    Help with Javascript program

    Posted: 01 Feb 2021 04:16 PM PST

    When i try to run the program, it says that lines 35-39, or where the set text is, says setText() text parameter value ( a lot of numbers) is not a uistring. From what I have seen elsewhere online, the variables would be numbers, not strings. However, I don't see where that is. The variables being used there are lists, not arrays, so I don't understand why this error message is forming

    var city = [(getColumn("Daily Weather", "City"))];

    var maincond = [(getColumn("Daily Weather", "Main Condition"))];

    var low = [(getColumn("Daily Weather", "Low Temperature"))];

    var high = [(getColumn("Daily Weather", "High Temperature"))];

    var icon = [(getColumn("Daily Weather", "Icon"))];

    var forecastNumber = getColumn("Daily Weather", "Forecast Number");

    var tomorrowcity =[];

    var tomorrowcondition=[];

    var tomorrowlow=[];

    var tomorrowhigh=[];

    var tomorrowicons=[];

    tomorrow();

    onEvent("forecastButton", "click", function( ) {

    updateScreen();

    });

    function tomorrow() {

    for (var i = 0; i < city.length; i++) {

    if (forecastNumber [i] == 1) {

    appendItem(tomorrowcity, city[i]);

    appendItem(tomorrowhigh, high[i]);

    appendItem(tomorrowlow, low[i]);

    appendItem(tomorrowcondition, maincond[i]);

    appendItem(tomorrowicons, icon[i]);

    }

    }

    }

    function updateScreen() {

    var index = randomNumber(0, tomorrowcity.length - 1);

    setText("cityOutput", tomorrowcity [index]);

    setText("highTempOutput", tomorrowhigh [index]);

    setText("lowTempOutput", tomorrowlow [index]);

    setText("conditionOutput", tomorrowcondition [index]);

    setProperty("iconOutput", "image", tomorrowicons [index]);

    }

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

    Does anybody have any of those sample answers that you use when you fill out why you want to work for [BLANK] company?

    Posted: 01 Feb 2021 03:48 PM PST

    Blockchain for presidential voting?

    Posted: 01 Feb 2021 02:45 PM PST

    Idk if this is the place to ask this question, my understanding of blockchain is limited but I keep thinking if we can use a blockchain system for voting and will it be easier or more efficient? I thought that if we used it as a voting system it would decrease the chance of the vote being manipulated

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

    Object recognitoin

    Posted: 01 Feb 2021 01:46 PM PST

    First of all sorry for typos.

    I want to make a programable object recognitoin system. Basicly you will provide exapmles of things you want to see(face, car etc) and the system will find and follow them in real time. I want to use this for entertainment purposes like facerig. i have read that c/c++ are good in ai uses but i want to make sure before i dive deep in to the language. I dont have a lot of exprience with programming but i can learn it so diffuclty it wont be problem. Sorry if i missed anything i just got the idea its 4am here

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

    Bot for to save links from speedtest

    Posted: 01 Feb 2021 01:22 PM PST

    I was at work today and I was using https://www.speedtest.net/ to chart to graph our download and upload speed every 30 minutes . I saved the download, upload and the link into an excel sheet. I noticed how repetitive it was and thought it would be a perfect job for a bot. The only problem is I don't know where to get started. Could anyone give me some specific places to start with creating a bot like this? I am new to coding. I have some practice with python and c.

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

    [Semaphore files in Linux] Can the lockfile command be replaced with flock?

    Posted: 01 Feb 2021 01:18 PM PST

    Lockfile creates a semaphore file. I tried replacing it with flock in a bash script I'm using as I don't have lockfile available, but flock makes you specify a cmd as second param but I don't get why - is it different from lockfile? Does it not actually create a lockfile but it can only perform a locked command on one? Thanks for any help, I googled around but couldn't really understand the difference.

    Eg original line is "lockfile -r 0 <filename>" Can I replace with something like "flock -nx <filename>"?

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

    Populating a javascript array with MySQL data?

    Posted: 01 Feb 2021 07:07 AM PST

    Hi guys,

    I have an array that is built in javascript using hard coded data which populates markers on a google map. I need to make the data dynamic so it loops through however many records are in the MySQL database and populates the data. The code I have is below.

    markersData = { 'Marker': [ { type: 'Italian Food', name: 'Restaurant Name', lat: 48.854183, lon: 2.354808, map_image_url: 'img/thumb_map_single_restaurant.jpg', description: 'Restaurant Name', url_point: 'detail-restaurant.html' }, { type: 'Italian Food2', name: 'Restaurant Name', lat: 48.854183, lon: 2.354808, map_image_url: 'img/thumb_map_single_restaurant.jpg', description: 'Restaurant Name', url_point: 'detail-restaurant.html' } ] } 

    So for example I need to do something like this

    $stmt = $pdo->prepare('SELECT * from locations'); $stmt->execute(); foreach ($stmt as $row) { $type = $row['type']; $name = $row['name']; $lat = $row['lat']; $lon = $row['lon']; $image = $row['image']; ... etc } 

    Then pass these parameters into the javascript array in a looping format, but I'm relatively novice when it comes to javascript. I need the format to be the exact same as the first code snippet, including the 'Marker' part as that's how the googlemap marker is called.

    I'd greatly appreciate if someone could help out with this, thanks.

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

    How to implement friendships in social media platform

    Posted: 01 Feb 2021 01:03 PM PST

    Hey everyone, this is my first time posting in this subreddit and I was hoping someone could help me out a bit. I've been learning nodejs, expressjs, and many more frameworks and technologies lately and decided to test my knowledge by building a full stack social media platform. However, I would like to get some pointers about how to implement friendships in this social media platform. Specifically, I'm not too sure how to implement this on the database I'm using(MongoDB). My naive approach is to add a friends attribute to the users collection, and store all these inside an object or array. However, I'm sure there's got to be other efficient methods. I've already tried looking this up in the Google but I have not found anything useful. Last but not least, when this platform is finished, I would like to add it to my resume and push it on Git, that's why I want to learn the most efficient way to store these friendships in the database. Any input and pointers are highly appreciated it!

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

    I have a problem with koa rendering a page with litelement components properly with koa-static and not doing so while using koa-router/koa-send

    Posted: 01 Feb 2021 01:02 PM PST

    https://stackoverflow.com/questions/65996880/i-have-an-issue-serving-lit-element-over-koa-router-koa-send-but-it-works-using

    I asked the same question on Stack Overflow and the code is in that question

    (Note: the page renders fine and any plain html components on it are fine, the web components don't render in the first case)

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

    I am a High School student. How long will it take me to learn python?

    Posted: 01 Feb 2021 02:22 AM PST

    Opening serial port connection issue - can't find port path (windows) (python)

    Posted: 01 Feb 2021 11:31 AM PST

    I'm trying to communicate with my 3D printer via serial (putty) and I'm getting the following errors:

    File "C:\kivygui\MainMenu.py", line 44, in <module> ser = serial.Serial('/dev/ttyACM0', 115200) # open serial port File "C:\kivygui\virt\lib\site-packages\serial\serialwin32.py", line 33, in __init__ super(Serial, self).__init__(*args, **kwargs)

    File "C:\kivygui\virt\lib\site-packages\serial\serialutil.py", line 244, in __init__ self.open()

    File "C:\kivygui\virt\lib\site-packages\serial\serialwin32.py", line 64, in open raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError())) serial.serialutil.SerialException: could not open port '/dev/ttyACM0': FileNotFoundError(2, 'The system can not find the path specified.', None, 3)

    Command I'm passing:

    ser = serial.Serial('/dev/ttyUSB0', 115200)

    Putty settings:

    http://prntscr.com/xzjmcx

    http://prntscr.com/xzjmxm

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

    I cannot work out why my Dynamic programming solution would be SLOWER than a backtracking solution on leetcode. Find all palindrome partition problem

    Posted: 01 Feb 2021 04:43 AM PST

    I was hoping someone could help me figure out possibly why something might be the case.

    I just attempted this problem on leetcode:

    https://leetcode.com/problems/palindrome-partitioning/

    This is my solution to it, which is a bottom-up Dynammic programming solution

    EDIT: Removed link. Apparently it gives a 404, so code at bottom of post instead.

    I run this, and it completes in 164ms with 109Mb of memory.

    Quick summary. My idea behind the algorithm is exactly like the backtracking solutions you can read, except it memorises the solutions from some index i in the string s and onwards. That way it doesn't have to go recomputing them. This allows me to just merge solutions previously calculated.

    Shouldn't this be faster than working them out all over again? Like the backtracking ones?

    My only insight is that the backtracking ones since they don't use DP use A LOT less memory, and since mine chews up a lot of memory it might be the memory that is causing the overhead? It might also be that there is no need to store the solutions to the subproblems, and just the storing is taking time, but again i'm not sure.

    The backtracking ones seem to run 2x faster than mine. Does memory really add that much overhead? I can imagine it might add a small amount, but not 2x slower.

    Would like some insight from someone who is experienced in this sort of stuff. This is more a question of curiosity since I can't work out a definite answer.

    class Solution { public: vector<vector<string>> partition(string s) { vector<vector<vector<string>>> DP(s.size()+1); vector<vector<bool>> palinDP(s.size(), vector<bool>(s.size(), false)); DP[s.size()] = {{}}; for (int i = s.size()-1; i >= 0; i--) { for (int j = i+1; j <= s.size(); j++) { if (s[i] == s[j-1] && (j-i <= 2 || palinDP[i+1][j-2])) { palinDP[i][j-1] = true; for (int k = 0; k < DP[j].size(); k++) { DP[i].push_back({s.substr(i, j-i)}); DP[i].back().insert(DP[i].back().end(), DP[j][k].begin(), DP[j][k].end()); } } } } return DP[0]; } }; 
    submitted by /u/Brussel01
    [link] [comments]

    Is it possible to run Microsoft Orleans in classic ASP.NET MVC 4?

    Posted: 01 Feb 2021 10:32 AM PST

    I am trying to do a setup like in this (https://www.youtube.com/watch?v=yM-gpuw1uhM&t=424s) video, but I lack IHostBuilder in the classic aps.net mvc.

    Would be cool if it can be used in some of my legacy projects.

    I searched the docs, and google, but I get clumsy results for "asp.net core" instead of classic asp.net mvc. If someone could point me in the right direction I would be grateful.

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

    [JavaScript] help constructing tree from arrays

    Posted: 01 Feb 2021 10:15 AM PST

    Hi, on mobile so sorry if formatting isn't great.

    Suppose I have a group of arrays like:

    arr1 = ["pages", "category1", "tag1", "page1"] arr2 = ["pages", "category1", "tag1", "page2"] arr3 = ["pages", "category1", "tag2", "page3"] arr4 = ["pages", "category1", "tag2", "page4"]

    The number of arrays is also variable so for examples sake let's say:

    arrs = [arr1, arr2, arr3, arr4]

    I want to construct a tree that I can navigate such that "category1" is a child of "pages' and "tag1" and "tag2" are both children of "category1" and "page1" and "page2" are both children of "tag1" and "page3" and "page4" are both children of "tag2".

    The tree can be any format as long as I can do a BFS on it.

    There may be leaf nodes that have the same name but different parents, but there will never be non-leaf nodes that have the same name with different parent. All non-leaf nodes in the same level will have unique names

    It's been a while since I've done some proper data structures and I really can't get my head around how to go about constructing this.

    I appreciate any help, thanks

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

    Help :(

    Posted: 01 Feb 2021 12:52 PM PST

    it keeps giving me an error in class name. The file name is InfoOf3.java

    • stdout is not correct

    here is my code:

    import java.util.*;

    public class InfoOf3

    {

    public static boolean allEqual(int a, int b, int c){

    if(a==b&&b==c&&a==c)

    return true;

    else

    return false;

    }

    public static boolean twoEqual(int a, int b, int c)

    {

    if(a==b && b == c && a==c)

    return false;

    else if(a == b)

    return true;

    else if(b == c)

    return true;

    else if(a == c)

    return true;

    else

    return false;

    }

    public static boolean noneEqual(int a, int b, int c){

    if(a!=b && b!=c && a!=c)

    return true;

    else

    return false;

    }

    public static boolean areAscending(int a, int b, int c) //

    {

    if(a<=b && b<=c)

    return true;

    else

    return false;

    }

    public static boolean areDescending(int a, int b, int c) //

    {

    if(a>=b && b>=c)

    return true;

    else

    return false;

    }

    public static boolean strictlyAscending(int a, int b, int c)

    {

    if(a<b && b<c)

    return true;

    else

    return false;

    }

    public static boolean strictlyDescending(int a, int b, int c)

    {

    if(a>b && b>c)

    return true;

    else

    return false;

    }

    public static void main(String[] args) {

    int a,b,c;

    Scanner sc = new Scanner(System.in);

    System.out.println("Enter first value ");

    a = sc.nextInt();

    System.out.println("Enter second value ");

    b = sc.nextInt();

    System.out.println("Enter third value ");

    c = sc.nextInt();

    System.out.println("first number? "+a);

    System.out.println("second number? "+b);

    System.out.println("third number? "+c);

    System.out.println("allEqual: "+allEqual(a,b,c));

    System.out.println("twoEqual: "+twoEqual(a,b,c));

    System.out.println("noneEqual: "+noneEqual(a,b,c));

    System.out.println("areAscending: "+areAscending(a,b,c));

    System.out.println("areDescending: "+areDescending(a,b,c));

    System.out.println("strictlyAscending: "+strictlyAscending(a,b,c));

    System.out.println("strictlyDescending: "+strictlyDescending(a,b,c));

    }

    }

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

    Could someone help me add a class to my C++ program?

    Posted: 01 Feb 2021 09:04 AM PST

    I need to add a class and a friend function. This is highschool level code, im just really bad at the subject.

    #include <stdio.h> #include <iostream> using namespace std; #define N 4 bool solveMazeUtil( int maze[N][N], int x, int y, int sol[N][N]); void printSolution(int sol[N][N]) { cout << " Solution Maze\n"<< endl; cout << "--------------------------------------\n"<< endl; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) printf(" %d ", sol[i][j]); printf("\n"); } cout << "--------------------------------------\n"<< endl; } bool isSafe(int maze[N][N], int x, int y) { if ( x >= 0 && x < N && y >= 0 && y < N && maze[x][y] == 1) return true; return false; } bool solveMaze(int maze[N][N]) { int sol[N][N] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; if (solveMazeUtil( maze, 0, 0, sol) == false) { printf("Solution doesn't exist"); return false; } printSolution(sol); return true; } bool solveMazeUtil( int maze[N][N], int x, int y, int sol[N][N]) { if ( x == N - 1 && y == N - 1 && maze[x][y] == 1) { sol[x][y] = 1; return true; } if (isSafe(maze, x, y) == true) { sol[x][y] = 1; if (solveMazeUtil( maze, x + 1, y, sol) == true) return true; if (solveMazeUtil( maze, x, y + 1, sol) == true) return true; sol[x][y] = 0; return false; } return false; } int main() { int i, j; int maze[N][N] ; cout << "--------------------------------------\n"<< endl; cout << " Enter the elements in the Maze\n" << endl; cout << "--------------------------------------\n"<< endl; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { cin >> maze[i][j]; } } cout << "--------------------------------------\n"<< endl; cout << " Maze given.\n"<< endl; cout << "--------------------------------------\n"<< endl; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) {printf(" %d ", maze[i][j]); } printf("\n"); } cout << "--------------------------------------\n"<< endl; solveMaze(maze); return 0; } 

    If someone could help me in adding a class and a friend function I would owe you eevrything. Thanks :)

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

    Making changes to a live website

    Posted: 01 Feb 2021 08:59 AM PST

    First of all, I'm new to this so please bear with me. I need to make a small scale e-commerce website which just displays the items available in stock. I want to implement a functionality where after the website is completed and hosted on a server, an admin would be able to add new items to the stock or remove an existing item. How do I implement that functionality with vanilla JS or do I need Django/Node.JS for something like that?

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

    How can I handle document version control for client side web storage?

    Posted: 01 Feb 2021 08:59 AM PST

    I am using IndexedDB which is client-side storage of structured data for my website. Hence the client has json documents stored on their browser

    If a new version of a document comes up (let's say vs 2.0) and the document version the client has is 1.5 how do I alert the client code that its documents are behind?

    I feel storing the latest version # in a database or as a constant variable in the server side code and having the client constantly make an API call to check it is a bit messy. What would be the proper approach?

    Please note I'm not asking how to handle different versions of documents like what Document Versioning Pattern accomplishes. I'm asking how the client side knows its behind

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

    Reddit to Instagram autoposter

    Posted: 31 Jan 2021 11:13 PM PST

    I have a page on the instagram Where I Post Funny Videos, Photos from Reddit. mostly this is repetitive Task so I am thinking to automate this task. python script will download the content from reddit 1-2 times in a day and it will upload it on Instagram. I am thinking to use https://github.com/kekn9ne/Reddit-to-Instagram this script. anyone here tried such thing here? if yes can you tell me if my page will get banned if they find out about this.

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

    No comments:

    Post a Comment