• Breaking News

    Wednesday, December 1, 2021

    How exactly does ReadAsAsync map the Json data returned to my Model properties? Ask Programming

    How exactly does ReadAsAsync map the Json data returned to my Model properties? Ask Programming


    How exactly does ReadAsAsync map the Json data returned to my Model properties?

    Posted: 01 Dec 2021 04:32 PM PST

    My console app make a call to the CoinbaseApi to get the name for BTC. In my CurrencyModel.cs class I set up the Name property because that is all I want to return back. How does ReadAsAsyncmap the Json returned to the property I have in my model class? Was just curious.

    CurrencyCaller.cs class that calls the api.

    public class CurrencyCaller { private static string url = "https://api.exchange.coinbase.com/currencies/BTC"; public static async Task<CurrencyModel> GetCurrency() { HttpResponseMessage responseMessage = await ApiHelper.Client.GetAsync(url); if (responseMessage.IsSuccessStatusCode) { CurrencyModel responseReturn = await responseMessage.Content.ReadAsAsync<CurrencyModel>(); return responseReturn; } else { throw new Exception(responseMessage.ReasonPhrase); } } } 

    CurrencyModel.cs

     public class CurrencyModel { public string Name { get; set; } } 
    submitted by /u/ConsciousGoose2
    [link] [comments]

    Old but not highly active vs new and active GitHub account

    Posted: 01 Dec 2021 11:10 AM PST

    I have been putting off creating public GitHub account for very long time. Now I am facing dilemma, I have GitHub account that's like 2-3 years old (0 activity) or I can create new and have regular contributions.

    Does it even matter for recruiters?

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

    How do I embed the correct plots in the GUI that I created for the market where it randomizes stock percentages? With this code, the graph is displayed, but it's the same one for all 3 and not according to their percentages.

    Posted: 01 Dec 2021 09:26 PM PST

    # Demonstration for how to use yfinance API # To get yfinance to work, you must run the # following from a command line # pip install yfinance # pip install tkinter # pip install threading import yfinance as yf import tkinter as tk import threading from tkinter import ttk from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) from matplotlib.backend_bases import key_press_handler from matplotlib.figure import Figure import numpy as np # This will bring back a map of how a stock has changed based on a list passed in def loadCurrentStockData(stockList): stockMap = {} valueList= [] # define a nested function we can multithread with to improve speed def addStockToMap(stock): ticker_yahoo = yf.Ticker(stock) data = ticker_yahoo.history() previous = (data.tail(2)['Close'].iloc[0]) current = (data.tail(1)['Close'].iloc[0]) changePercent = current / previous valueList.append(changePercent) percentStr = ""; if changePercent >= 1: percentStr = str(changePercent)[2:6] if percentStr[0] == '0': percentStr = percentStr[1:] percentStr = '+' + percentStr[0:1] + '.' + percentStr[1:] + '%' else: percentStr = '+' + percentStr[0:2] + '.' + percentStr[2:] + '%' else: changePercent = 1 - changePercent percentStr = str(changePercent)[2:6] if percentStr[0] == '0': percentStr = percentStr[1:] percentStr = '-' + percentStr[0:1] + '.' + percentStr[1:] + '%' else: percentStr = '-' + percentStr[0:2] + '.' + percentStr[2:] + '%' stockMap[stock] = percentStr # use multithreaded function for stock in stockList: threading.Thread(target=addStockToMap(stock)).start() total=0 for v in valueList: total+=v total=total/5 totalStr='' if total >= 1: totalStr = str(total)[2:6] if totalStr[0]=='0': totalStr=totalStr[1:] totalStr = '+' + totalStr[0:1] + '.' + totalStr[1:] + '%' else: totalStr = '+' + totalStr[0:2] +'.'+totalStr[2:] + '%' else: total=1-total totalStr = str(total)[2:6] if totalStr[0]=='0': totalStr=totalStr[1:] totalStr = '-' + totalStr[0:1] +'.'+totalStr[1:]+ '%' else: totalStr = '-' + totalStr[0:2] +'.'+totalStr[2:]+ '%' stockMap['Overall']=totalStr return stockMap # define stock lists (I used some from each index for example purposes dowList = ['GS', 'PG', 'JPM', 'CSCO', 'CVX'] nasdaqList = ['TSLA', 'AAPL', 'AMZN', 'MSFT', 'NIO'] sANDpList = ['AMZN', 'FB', 'GOOGL', 'NVDA', 'AMGN'] rootTemp = tk.Tk() rootTemp.title("Stock Chart") tabControl = ttk.Notebook(rootTemp) # Create tabs on GUI tab1 = ttk.Frame(tabControl) tab2 = ttk.Frame(tabControl) tab3 = ttk.Frame(tabControl) # Add tabs tabControl.add(tab1, text='Dow') tabControl.add(tab2, text='Nasdaq') tabControl.add(tab3, text='S&P') tabControl.pack(expand=1, fill="both") # Set text on each tab ttk.Label(tab1, text='Loading... please wait...').grid(column=0, row=0, padx=100, pady=100) ttk.Label(tab2, text='Loading... please wait...').grid(column=0, row=0, padx=100, pady=100) ttk.Label(tab3, text='Loading... please wait...').grid(column=0, row=0, padx=100, pady=100) def loadWindow(panel): # load data from lists dowMap = loadCurrentStockData(dowList) nasdaqMap = loadCurrentStockData(nasdaqList) sANDpMap = loadCurrentStockData(sANDpList) # Create GUI root = tk.Tk() root.title("Stock Chart") tabControl = ttk.Notebook(root) # Create tabs on GUI tab1 = ttk.Frame(tabControl) tab2 = ttk.Frame(tabControl) tab3 = ttk.Frame(tabControl) # Add tabs tabControl.add(tab1, text='Dow') tabControl.add(tab2, text='Nasdaq') tabControl.add(tab3, text='S&P') tabControl.pack(expand=1, fill="both") # Store maps as strings to display global dowString global nasdaqString global sANDpString dowString = str(dowMap) nasdaqString = str(nasdaqMap) sANDpString = str(sANDpMap) dowString = dowString.replace(',',',\n') nasdaqString = nasdaqString.replace(',',',\n') sANDpString = sANDpString.replace(',',',\n') if panel is not None: panel.destroy() # Set text on each tab label1=ttk.Label(tab1, text=dowString).grid(column=0, row=0, padx=100, pady=100) ttk.Label(tab2, text=nasdaqString).grid(column=0, row=0, padx=100, pady=100) ttk.Label(tab3, text=sANDpString).grid(column=0, row=0, padx=100, pady=100) fig = Figure(figsize=(5,4),dpi=100) t = np.arange(0,3,0.1) fig.add_subplot(111).plot(t,2*np.sin(2*np.pi*t)) canvas = FigureCanvasTkAgg(fig, master=root) canvas.draw() canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1) toolbar = NavigationToolbar2Tk(canvas, root) toolbar.update() canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1) # Launch window try: rootTemp.destroy() except: pass def update(): loadWindow(root) root.after(15000, update) root.after(15000, update) root.mainloop() rootTemp.after(100, loadWindow,None) rootTemp.mainloop() 
    submitted by /u/ProfessorBeast55
    [link] [comments]

    Steam game play time

    Posted: 01 Dec 2021 08:49 PM PST

    Is there a way to graph total time played on all steam games together? I can see individual play totals

    I have 100+ games on steam, I can individually see total play times when i highlight the game. Some 5 min or few hours, others more or less. Would it be possible to take this data and make a graph of all games in steam?

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

    Is copying an existing app idea illegal?

    Posted: 01 Dec 2021 12:10 PM PST

    Hi! I'm currently learning app development in Android Studio and I thought it would be great experience to build app similar to GeoGuesser (you spawn in place on a map, and you need to guess where). In case I succeed, will it be legal to publish my app on public platforms like play store and others?

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

    what makes a great resume?

    Posted: 01 Dec 2021 06:53 AM PST

    hey guys, so i know c and python enough to build a good programming resume in github but i don't know what to build to make the resume valuable for example a network montoring project already existed and it doesn't seem sensible for me to create it again. so i don't know if a project like this is enough or i should make something more useful, also i really like what makes a resume remarkable is that year experience or etc ? please if you had those experiences share it with us Thank you.

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

    Trying to extract specific elements from a nested list

    Posted: 01 Dec 2021 06:30 PM PST

    Hi,I'm trying to build up a nested list, ttc_list which itself contains lists of a ball object, another ball object, and the time taken for these two balls to collide. Then, my code will look into the nested list, and extract the list which contains the smallest positive time value.

    This is how I have tried to do it:

     def next_collision(self): ttc_list = [] for i in range(0, num_particles-1): print('ball i', i) for j in range(i+1, num_particles): print('ball j', j) ttc_list.append([self._balls[i], self._balls[j], self._balls[i].time_to_collision(self._balls[j])]) ttc_list.append([self._balls[i], self._container, self._balls[i].time_to_collision(self._container)]) print('ttc list', ttc_list) temp_time = ttc_list[0] print('temp time tuple is', temp_time) for m in ttc_list: for p in m: print('p is', p, type(p)) print(ttc_list[p]) if temp_time[2] > ttc_list[p][2]: temp_time = ttc_list[p] (b1, b2, t) = temp_time print('min time tuple is', temp_time) 

    essentially, it performs a method time_to_collision which calculates the time for two balls, i and j, to collide. It then appends a list of two ball objects, and the time for these two balls. This list is appended to ttc_list, and thus I have a nested list, which looks something like this:

    [[Ball(Mass = 1, radius = 1), Ball(Mass = 1, radius = 1), 0], [Ball(Mass = 1, radius = 1), Container(radius = -10, mass =1e+09), 4.68465843842649] 

    Note: Container is simply a child class of ball, hence why I have two append lines. I then create a variable, temp_time = ttc_list[0] which basically sets temp_time to equal the first list in ttc_list. Then, I have two for loops to check through all of the lists in ttc_list. It checks if the time term (index 2) in temp_time is greater than the time term in the mth list. If it is, then temp_time now equals this new mth list. It will then continue to do this comparison for all of the lists, until temp_time is the list with the lowest time value in ttc_list.

    1. I get an error with this method,

     if temp_time[2] > ttc_list[p][2]: TypeError: list indices must be integers or slices, not Ball 

    I don't understand why it thinks p is a ball object? I thought it was just the variable used in the for loop to cycle through each list in ttc_list?

    1. How can I adapt this so that it only takes the minimum positive number? There is a possibility that negative times may be calculated, which I would like to ignore.

    Many thanks,

    Sid

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

    How to get length of multi dimensional array with nested for loop?

    Posted: 01 Dec 2021 05:22 PM PST

    If you have const mynumbers = [["one","two","three"],["four","five","six"],["seven","eight","nine"]]; then how do you control for the length of these in the nested for loop?

    So I have

    for (let h = 0; h < mynumbers.length; h++) { for (let i = 0; i < ???.length; i++) { } } 

    What do I need for ??? here?

    submitted by /u/puzzle-game
    [link] [comments]

    I work in QA, the dev sent me a task to check "delete device token" on iOS, how do I test this?

    Posted: 01 Dec 2021 02:21 AM PST

    Dijkstra's algorithm code to store the vertices contained in each shortest path not outputting correctly?

    Posted: 01 Dec 2021 03:29 PM PST

    I implemented Dijkstra's algorithm to find the shortest path from the source vertex to all other vertices, and I also wanted to store what vertices make up each shortest path. I did this by keeping track of each vertex's predecessor. It is able to output the distances correctly, but as seen in the output below (ignore the candy stuff), two of the paths got switched (the path from the src to vertex 3 and the path from the src to vertex 4. I'm not sure why it is not outputting correctly? I must've done something wrong when storing the predecessors.

    This is what the graph looks like.

    https://i.imgur.com/XesJnFd.png

    The code in python...

    from queue import PriorityQueue class Graph: def __init__(self, num_of_vertices): self.v = num_of_vertices self.edges = [[-1 for i in range(num_of_vertices)] for j in range(num_of_vertices)] self.visited = [] def add_edge(self, u, v, weight): self.edges[u][v] = weight self.edges[v][u] = weight def dijkstra(self, start_vertex): D = {v:float('inf') for v in range(self.v)} V = {v:None for v in range(self.v)} D[start_vertex] = 0 pq = PriorityQueue() pq.put((0, start_vertex)) AllPathsList = [] while not pq.empty(): (dist, current_vertex) = pq.get() self.visited.append(current_vertex) for neighbor in range(self.v): if self.edges[current_vertex][neighbor] != -1: distance = self.edges[current_vertex][neighbor] if neighbor not in self.visited: old_cost = D[neighbor] new_cost = D[current_vertex] + distance if new_cost < old_cost: pq.put((new_cost, neighbor)) D[neighbor] = new_cost V[neighbor] = current_vertex S = [] u = current_vertex while V[u] != None: S.insert(0, u) u = V[u] S.insert(0, start_vertex) AllPathsList.append(S) return D, AllPathsList def main(): g = Graph(6) g.add_edge(0, 1, 4) g.add_edge(0, 2, 7) g.add_edge(1, 2, 11) g.add_edge(1, 3, 20) g.add_edge(3, 4, 5) g.add_edge(3, 5, 6) g.add_edge(2, 3, 3) g.add_edge(2, 4 ,2) # 0, 1, 2, 3, 4, 5 CandyPerVertexList = [0, 5, 4, 7, 8, 2] D, AllPathsList = g.dijkstra(0) for vertex in range(len(D)): print("Distance from my house to house #", vertex, "is:", D[vertex], "min") print("Particular path is:", AllPathsList[vertex]) CandySum = 0 for num in range(len(AllPathsList[vertex])): CandySum = CandySum + CandyPerVertexList[AllPathsList[vertex][num]] print("Candy amount for this path: ", CandySum) print() main() 

    And the output

    Distance from my house to house # 0 is: 0 min Particular path is: [0] Candy amount for this path: 0 Distance from my house to house # 1 is: 4 min Particular path is: [0, 1] Candy amount for this path: 5 Distance from my house to house # 2 is: 7 min Particular path is: [0, 2] Candy amount for this path: 4 Distance from my house to house # 3 is: 10 min Particular path is: [0, 2, 4] Candy amount for this path: 12 Distance from my house to house # 4 is: 9 min Particular path is: [0, 2, 3] Candy amount for this path: 11 Distance from my house to house # 5 is: 16 min Particular path is: [0, 2, 3, 5] Candy amount for this path: 13 
    submitted by /u/trident_zx
    [link] [comments]

    Is it possible to create an ebay-like website.

    Posted: 01 Dec 2021 11:23 AM PST

    Hello.

    I am recently thinking of writing something ebay-like but with a few extra ideas.

    I have a question about whether is it efficient to use something like python in combination with PHP to achieve this goal? Or should I learn something different from scratch? I am not planning to make this into a live site, I just want to see if I am capable of doing such a thing.

    Thanks in advance.

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

    Git Sync and Merge doesn't always grab latest

    Posted: 01 Dec 2021 10:15 AM PST

    I've been having a random issue with Visual Studio for years, but I'm not sure who to blame.

    Here is my process before PR'ing:

    1. Check In changes: Team Explorer -> Changes -> Commit All and Sync
    2. Grab latest from Main: Team Explorer -> Branches -> Merge from Origin/Main into Current Branch
      1. If any conflicts, carefully go through each one and Accept Merge's
    3. Double-Check that it builds and runs
    4. Create Pull Request

    I use the GUI to do this. Sometimes I'll Sync multiple times between 2 and 3.

    And yet, I constantly get asked

    "Hey /u/ViveMind, I don't see somebody else's changes in your PR. Did you merge latest?"

    I'm constantly made to feel like I'm an idiot that doesn't know basic GIT. "I don't know why you use Sync, just do Fetch/Pull/Push from Command Line", they'll say.

    Am I doing something wrong? This has happened so many times that I'm wondering if I'm the common denominator.

    Side Note: My company is extremely locked down with a slow VPN. It takes 60s+ to fetch/pull/whatever. I have a sneaking suspicion that the VPN could be a culprit. But also, this isn't the only job I've had this issue in.

    Edit 2: I just pulled, merged from main, and pushed twice in a row and it pulled new stuff both times. Wtf...

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

    Raspberry Pi - (2x)Client to Server video stream & Object Detection from server

    Posted: 01 Dec 2021 01:10 PM PST

    Greetings..

    I have 2 Raspberry Pi, 2 webcam and Macbook as server. I need to stream video from Raspberry Pi to server. I need to see these videos on a web server. These videos must be watched and object recognition performed by the server. I know how to do object recognition (tensorflow), but I don't know the client-server side.

    Can you help me what steps should I take to do it?

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

    Singleton creating multiple instances in React

    Posted: 01 Dec 2021 01:07 PM PST

    Hello, I am trying to create an app in React that allows multiple people to join a room to vote on user submitted options, however each user should only have one websocket connection to the backend. I created a singleton that works great on a test app with all functions being used on one page, but it seems like multiple instances of the socket are being created on different pages of the app. Below is the code for my websocket singleton. ``` import ReactDOM from "react-dom"; import React from 'react';

    class Socket { private static instance: Socket; public ws: WebSocket; private static ready: boolean; private static roomID: string; private static options: string; private static isHost: boolean; private constructor() { this.ws = new WebSocket("ws://localhost:25565"); Socket.isHost = false; this.ws.onopen = function() { Socket.ready = true; } } public static getInstance(): Socket { if(!Socket.instance) { Socket.instance = new Socket(); } return Socket.instance; }

    public createRoom() { if (Socket.ready) { this.ws.send("request_create_room"); } this.ws.onmessage = function (evt) { var received_msg = evt.data; var received_split = received_msg.split(" "); Socket.getInstance().setRoomID(received_split[1]); Socket.isHost = true; Socket.getInstance().joinRoom(); // @ts-ignore document.getElementById("goToRoomInfo").click(); ReactDOM.render( <p>Room Code: {Socket.getInstance().getRoomID()}</p>, document.getElementById("roomShare")); } } public joinRoom(room: string = Socket.roomID) { var request = "request_join_room "; request = request.concat(room) if (Socket.ready) { this.ws.send(request); } this.ws.onmessage = function (evt) { if (evt.data === "request_join_room_success") { return("Joined room".concat(room).concat("successfully")); } } } public closeRoom() { if(Socket.ready) { this.ws.send("close_room"); } } public addOption(option: string) { var request = "add_option " request = request.concat(option); if(Socket.ready) { this.ws.send(request); } } public setOptions(){ if(Socket.ready) { this.ws.send("get_options"); } this.ws.onmessage = function (evt) { Socket.options = evt.data; } } public getOptions(): string { return(Socket.options); } public getRoomID(): string { return(Socket.roomID); } public setRoomID(id: string) { Socket.roomID = id; } 

    } export default Socket; ```

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

    Regex fails to match on my machine, but not others

    Posted: 01 Dec 2021 09:09 AM PST

    this started randomly after another dev pushed code, but not to the start script, which is where the problem lies:

    const fs = require('fs'); const path = require('path'); const { execSync } = require('child_process'); const variablesJs = path.resolve(__dirname, '../public/variables.js'); const variablesJsContents = String(fs.readFileSync(variablesJs)); const everythingBetweenBracketsRegex = /(\{(.|\n)*\})/; console.log(everythingBetweenBracketsRegex); console.log(variablesJsContents); console.log("matches?", everythingBetweenBracketsRegex.test(variablesJsContents)); 

    I added the console.logs which show that the regex and the contents of the file are as they should be. the regex .test method returns false for my machine, but not for others. I can't for the life of me figure out why. I thought it might be a node issue, but another dev running similar versions to mine was able to run the script successfully. Are there incompatibilities with regex in JS?

    edit: the variablesJsContents looks like this:

    window.variables = { "key1": "value1", "key2": "value2", "key3": "value3", ... }; 
    submitted by /u/killwhiteyy
    [link] [comments]

    How to display product cards for an e-commerce app in react?

    Posted: 01 Dec 2021 12:08 PM PST

    Hi, i'm currently working on my first big project, an e-commerce app using React(Javascript) for frontend, spring-boot backend and MySQL for my database. Currently, I have completed the login and register pages, I have also added some products to my database and made some card components using MaterialUI, but I don't know how to get my information from the database and display it randomly on cards, as a grid of 4-5 columns of products. Any idea on how I could do that?

    P.S. Sorry for my bad english, it's not my mother tongue.

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

    Best way to create an add/remove table with priorities?

    Posted: 01 Dec 2021 11:55 AM PST

    Hi all,

    I'm not really sure if this is the correct place to post this, but I'm going to give it a shot anyway. I would post a picture of what I'm talking about but apparently this forum doesn't allow pictures so I'll do my best to describe it.

    I want to create what I'm going to call an add/remove table with priorities - if someone knows of what this is actually called, please feel free to correct me. The best example of what I mean is when you go to add/remove features from a ribbon on excel or really any microsoft office program, two columns appear with add/remove buttons in the middle where you can add something from the left column into the right column or remove it from the right column. Then theres a priority button on the far right to move things up or down in the right column and modify the hierarchy. I want to create something similar, I don't need this exact functionality but what I need it for is very similar (some differences would be -> can manually add things to the left column instead of using the button, instead of one right column I would have multiple that items can be funneled/added into, will also need to pull some data from a database, etc..).

    I am very familiar with vba and I am willing to learn more python. With some effort I could create something like this in excel or access with vba but before I dove headfirst into it, I'd be interested if anyone had a better or similar idea on how to do this - especially if there were some pre-existing tools or applications for it.

    Thanks in advance!

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

    Is there a Notion.so/Obsidian/etc alternative that allows for linking within code blocks?

    Posted: 01 Dec 2021 11:16 AM PST

    I find that a feature like this would be indispensable. It would be really nice to be able to link to reference pages or documentation for individual functions or types within the code block so you can just click and instantly go there for more information.

    Has anyone seen a notes program with this functionality?

    I would also accept plugins for existing programs that allow for this functionality as well!

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

    Ideas on architecture for remotely controlling a recording utility on a desktop

    Posted: 01 Dec 2021 10:36 AM PST

    So I'm currently working on a project for a friend who wants me to design and build a piece of software to essentially record videos on their mac, controlling it ONLY using some locally-hosted UI that could be accessed from their phone or another device (starting/stopping recordings, etc).

    I'm new when it comes to programming with audio/video recordings but so far I've set up a basic recording program in javascript that uses live-server to host it locally and allow devices on my network to access the program through a web browser. This is where I ran into a problem with how I've found to record media, using navigator.mediaDevices to select a device to start recording from since it allows the user to select from devices connected to the machine that's accessing the program, instead of only using the host machine's devices to record from while allowing all other devices to just control the functions.

    My next idea is separating the recording utility from the UI and run the recording application through a local service on the host machine and implement an API for the UI to call to control the recording utility through websockets, but I had a lot of troubles maintaining full functionality of recording/stopping/downloading while deploying the program using either live-server and socket.io, and this is where I started to question my choices so far.

    At this point I'd just like opinions on if I'm making things harder on myself by not using more useful functions or packages I haven't found. I'm using Node.js, npm, mediaRecorder, live-server, tried socket.io, but with my troubles trying to host my Javascript application locally and getting ANY functionality to work when using anything but the host machine. I just don't know whether it'd be easier to restart using a different language or set of packages or a different way the architecture could be handled that'd simplify it? It's probably pretty obvious I'm not a very experienced programmer so any and all help would be appreciated, even it's telling me I'm a dumbass for doing it this way when there's a much easier approach.

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

    Why do programmers get paid more in America than they do in the European Union?

    Posted: 30 Nov 2021 11:49 AM PST

    Is it possible to use FilePond with TypeScript?

    Posted: 01 Dec 2021 07:07 AM PST

    I need to implement image and video upload and edit functionality in my website and I've found FilePond as a great solution to that. However I'm curious about is it possible to use it with TypeScript, because documentation doesn't cover that, and there are not so many solutions for that on the internet. Hope somebody helps

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

    When adding error handling, is it enough to produce errors on one's own code's level, rather than relate it to some subfunction's error handling from another package?

    Posted: 01 Dec 2021 02:40 AM PST

    When adding error handling, is it enough to produce errors on one's own code's level, rather than relate it to some subfunction's error handling from another package?

    So e.g. if I use some other function from some package and it throws an error, then do I need to handle this, or is it enough that I handle only those that are caused by the code I've produced?

    I think that when using libraries one should be able to assume that the implementers have added error handlings on them so that one doesn't need to care about feeding wrong inputs and NOT having an error message on them if the errors occur in external code.

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

    Stuck in a rut and looking for new roles

    Posted: 01 Dec 2021 06:08 AM PST

    Hello, hope this is ok to post here as it's more releated to a programming career (as opposed to programming itself).

    I've been at my current role for almost 9 years now. I've stuck with this company through regime changes, acquisitions and huge growth. If there's anything I've learned from this, loyalty is way overrated.

    My main role was mostly front-end development but that's evolved into e-commerce development (Magento if you must ask). Promises were made about the direction of my role, like new hires to support, but it would seem my company were put off by the salary of potential suitors. We've instead lost staff. And now it's just me dealing with this platform. Again, stupid me for believing them.

    Anyway, since then (about 4-5 years), FED has moved on leaps and bounds - however due to the nature of learning Magento on the job (with almost no support) means I feel like I've got a lot of catching up to do.

    My company seems to be winding down on the SME side of things and I fear we'll all be made redundant at some point next year. Their focus appears to be shifting towards one of the companies they acquired, which doesn't deal with website development.

    I've been looking into other Magento jobs (and had a couple of interviews), but I feel that my learning-on-the-job has been to my disadvantage too. We do a lot of outsourcing, so it's mostly dealing with the platform between development and delivery.

    It's not that I don't know \enough** about Magento, it's more like I've been starved of working within a team environment, so I've done a lot of things *my* way, which may or may not necessarily be the *right* way. This means the thought of joining another team makes me anxious, because I probably missed some of the basics.

    I think as it stands, the best route is catching up on the gaps in what little spare time I have. After a day of Magento though, the thought of looking at the screen in the evening makes me a little nauseated!

    How can I explain this to potential employers? Ideally I'd want to sit them down and say "Look, I know Magento, but I have a lot of gaps in my knowledge that I'd like to fill, trust me on this". The same goes for looking for general Front End jobs - employers tend to look for React, Vue and other js frameworks which haven't been used in Magento.

    I have no-one to blame but myself here. I shouldn't have been so blindly loyal and I should have kept abreast of things.

    Thanks

    TL;DR - I've been too loyal to my current company, I've been left behind in FED technology, How do I present this to employers?

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

    What type of questions will I be asked in 30 min technical interview?

    Posted: 01 Dec 2021 05:03 AM PST

    Hello guys, I have the final interview of angular Bootcamp.

    1st level was logic and js test;

    2nd level Hr interview;

    and on email, they said it is the final level, so there won't be any more interviews,

    So on the 3rd and final level, there is the technical interview and if I get past this, I am in.

    I thought they would bring algorithms, but I believe 30 min is not much time, also prerequisites are so low that I can't guess what they could ask me. If anyone had the same experience, could you share? Any advice will be appreciated. Thank you.

    P.S I am not lazy I searched a lot on google, just it is my first interview so I want to be prepared

    Prerequisites:

    Have experience with the basics of computer programming.

    Be comfortable with writing HTML and CSS.

    Understand and have experience with basic JavaScript. More specifically:

    Statements, variables, operators, and functions.

    Data types.

    Conditions and loops.

    Basics of events.

    HTML DOM.

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

    Language comparison question: function parameters with defaults, early versus late binding

    Posted: 01 Dec 2021 01:00 AM PST

    I am doing a review of when programming languages with default values for function parameters evaluate those default values:

    • which languages use early binding for the default value;
    • which use late binding;
    • which offer both;
    • the syntax they use;
    • especially those that offer a choice.

    (If it is unclear what I mean by early and late binding, see below.)

    Can anyone suggest some examples? Or pointers to language comparisons that discuss this? Or even some better terminology?

    What I am looking for is specifically about when the default values are evaluated. Alas, the terminology of early/late binding has many uses and meanings which are not relevant, and those meanings dominate the search results when I google. For example, this is not what I am looking for.

    To be clear what I am referring to, in early binding, the default value expression is evaluated as early as possible (when the function is first compiled), and the value is cached. Then whenever the default value is needed, the cached value is used. That is the behaviour in Python, which leads to a well-known gotcha.

    In late binding, the expression is not evaluated until it is needed, and the result is never cached. Each time the default is needed, the expression is re-evaluated, and the result used as the default. That is the behaviour in recent versions of Javascript.

    A concrete example, using Python syntax:

    def roll_die(): # Simulate rolling a die. return random.randint(1, 6) def show_number(value=roll_die()): print(value) 

    if no argument is passed to show_number then under early binding it will always print the same value, whatever roll_die() happened to generate the first (and only!) time it was called:

    5, 5, 5, 5, 5, ... 

    Under late binding you will get a new roll of the die each time:

    5, 4, 1, 5, 3, ... 

    To reiterate what I am looking for:

    • is there another terminology I can google for that will relate specifically to function parameters and default values?

    • can anyone suggest a good language comparison guide that discusses function default parameters, specifically when they are evaluated? There is a good comparison guide here but it doesn't discuss default arguments.

    • and can people suggest examples of early/late bound function defaults in modern languages, with an emphasis on languages which support both styles?

    Thanks in advance.

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

    No comments:

    Post a Comment