• Breaking News

    Sunday, January 3, 2021

    Seems like bad code is often more profitable than good code? Ask Programming

    Seems like bad code is often more profitable than good code? Ask Programming


    Seems like bad code is often more profitable than good code?

    Posted: 03 Jan 2021 08:02 AM PST

    I wrote some code 10 years ago for a project. It basically imports user records from one a large enterprise database system to another. It took me about 4 weeks to do this and I was very careful to cover all edge cases and make sure it would work without issue even though they were pressuring me to get it out the door faster. Sure enough it worked every day for 10 years without having any issue at all. I worked my butt off for this.

    Now I learned they put a new guy to rewrite the code for the main system, and in order to integrate they wrote a replacement for my software as well. Turns out every month for the last year there have been errors with the new import code and user records are failing to import and people are getting locked out. And the new programmer has to go onsite and tinker with the code and run tests and updates (the enterprise client has a closed network). So they pay him to fly out there and stay in a hotel and pay for meals every month or 2 and he gets paid the high consultant rate for this. So basically since the code always seems to have bugs he keeps getting paid to fix them.

    Makes me wonder about things. What are your thoughts?

    submitted by /u/Melodic-Literature-6
    [link] [comments]

    Why doesn't my queue program print the second node?

    Posted: 03 Jan 2021 09:46 PM PST

    https://ibb.co/mSNxTcV

    #include<stdio.h> #include<stdlib.h> typedef struct queue{ int value; struct queue* prev; }queue; queue* front=NULL, *back=NULL; void inqueue(int value){ queue* temp=malloc(sizeof(queue)); temp->value=value; temp->prev=back; back=temp; //empty case if(front==NULL){ front=back; } } int dequeue(){ //empty case if(front==NULL){ printf("Error"); return 0; } //only one node if(back->prev==NULL){ int i=back->value; back=NULL; free(front); front=NULL; return i; } queue* temp=back; int i=front->value; while(temp->prev!=NULL && temp->prev!=front){ temp=temp->prev; } front=temp; temp=temp->prev; free(temp); return i; } int main(){ inqueue(2); inqueue(8); printf("%d ",dequeue()); printf("%d ",dequeue()); } 
    submitted by /u/JacksonSteel
    [link] [comments]

    Is there an IDE where you can see exactly what your code is doing in a box?

    Posted: 03 Jan 2021 09:32 PM PST

    I was watching this video of someone making flappy birds with Javascript. And they used a browser to see it, which I'm not entirely sure how they did that. But it got me thinking, is there an IDE that you can download that has that function already built into it?

    https://www.youtube.com/watch?v=M45iFPVdtj0 << This is the video, but I'm looking for something that has the function already built into it. Thank you.

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

    Can I download files in parallel?

    Posted: 03 Jan 2021 09:21 PM PST

    I'm not sure if this is a dumb question or not.

    I'm trying to download and process a bunch of data but it can all be done in parallel chunks. I've got the processing parallelized using GNU Parallel but am running into issues when trying to parallelize the downloading, specifically timeout issues. I don't know much about networking so I'm not even sure if it makes sense to be downloading things in parallel.

    I'm running this on a laptop with a quad-core processor.

    I've noticed that GNU Parallel allows the max # of jobs to be 8. When I set this number to 4, the number of cores, the timeout issue seems to go away and the downloading chugs along just fine.

    From what I've read, I think this is because my processor uses "hyperthreading" so it presents itself as having more cores than it actually does. Not sure what the point of this is or why it would only be an issue when downloading files.

    Hoping for someone with more experience to explain this.

    Thanks!

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

    How does communication work in an event driven micro-service architecture?

    Posted: 03 Jan 2021 11:49 AM PST

    Hi all,

    As per the title how does communication work in event driven micro-service architecture. From what I understand there are many means and technologies that allow for it but I would like to understand why a company may choose Redis-Streams over RabbitMQ etc.

    What types of decisions have to be made? What factors influence choices?

    Currently I am working on a basic search-engine that runs in Docker Containers with Python as a base language. Looking to start implementing a backend event-driven messaging system and would love to understand them in greater depth.

    Feel free to check out my project here. Please note that it is only a side project and is for learning purposes only :) My goal was to create a search engine for a limited set of sites that I use for research to save time searching each individual site.

    https://github.com/AbdullahRehmat/SoundSearch

    TIA!

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

    How to use python selenium to click this element with text 'bb1' ?

    Posted: 03 Jan 2021 06:55 PM PST

    <yt-formatted-string id="channel-title" class="style-scope ytd-account-item-renderer">bb1</yt-formatted-string> 

    below one is a dangerous find element by full x path because the index might change

    self.driver.find_element_by_xpath('/html/body/ytd-app/ytd-popup-container/iron-dropdown/div/ytd-multi-page-menu-renderer/div[4]/ytd-multi-page-menu-renderer/div[3]/div[1]/ytd-account-section-list-renderer[1]/div/ytd-account-item-section-renderer/div/ytd-account-item-renderer[4]/paper-icon-item/paper-item-body/yt-formatted-string[1]').click() 
    submitted by /u/hwpcspr
    [link] [comments]

    Is it realistic to hope to rise a tiny amount of money on an utility software without being "known"?

    Posted: 03 Jan 2021 02:57 AM PST

    Hi, I'm just a student and I'm extraneous to all the real world side of making software.

    I've made a nice desktop tool (on the lines of Rainmeter + HWiNFO) for hardware monitoring for personal use. But a couple course-mates made it sound like it's amazing, so I'm thinking I might rise some money with it? If that even makes sense, How should I proceed?

    • Making the tool open source and leaving a "donations" button? If so, how do donations work? I know GitHub has a built-in donations feature but I've no idea how popular it is; to me it looks more like something that targets "famous" contributors rather than random commoners releasing their thing, correct me if I'm wrong.
    • Try to launch on steam's software/utility section (alongside Fences etcc)
    • Turn it into an UWP and use the MS store (personally I don't use it so I've no idea how popular is it to search for software there)
    • Any other alternative?
    submitted by /u/sephirothbahamut
    [link] [comments]

    Basic Design Question: Web Services and Business Objects

    Posted: 03 Jan 2021 06:33 PM PST

    Hi, design a web service and trying to decide if it makes sense to push all the business logic into business objects that would actually perform the CRUD. Is this the recommended pattern? And if so, should I be using IoC for the connection used by the business objects?
    As a separate question: should my business objects be the nouns from my model or can they simply be classes with the CRUD operations that take the nouns-as-data-types as parameters and/or return the nouns?
    As an example:
    if I have a noun, Person, from my model, and I now have a web service that has an operation addPerson(), should I have a Person definition that is separate from a PBO? PBO would be instantiated by the web service (passing in conn info) and would have an addPerson() operation that takes a Person object as a parameter.

    If this design is fine, then what are the naming conventions for such business objects?
    and if it isn't fine, what is the risk in separating my business objects from my nouns in this manner?

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

    How to make input eof(Ctrl+z) while letting the scanf have a space before the specifier to avoid getting previous \n error?

    Posted: 03 Jan 2021 06:21 PM PST

    https://ibb.co/D5D4nMS ( I hit enter, ok)

    #include<stdio.h> #include<stdlib.h> int main(){ int target,result; while(1){ printf("Please input your target: "); scanf(" %d",&target); if(feof(stdin)){ break; } printf("test\n"); } } 

    if I change the code to:

    #include<stdio.h> #include<stdlib.h> int main(){ int target,result; while(1){ printf("Please input your target: "); scanf("%d",&target);//no space if(feof(stdin)){ break; } printf("test\n"); } } 

    it worked

    https://ibb.co/hfBqZkd

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

    I'm writing a little API for a personal project, and I cannot wrap my head around REFRESH TOKENS

    Posted: 03 Jan 2021 03:49 PM PST

    I want to start saying that I'm a newbie, so sorry if the question sounds stupid.

    I'm writing a small API for a personal project and for the last couple of days I've been stuck on how to correctly implement a Token based authentication system.

    I found out that the best practice seems to have a refresh token (long lived) through which generate access tokens (short lived) to authorize access to specific items.

    What I really cannot understand is why I need to have a two separate tokens? from what I gathered both have to be returned to the client so that the client can request a new access token after one expires.
    It seems to me that with a refresh token the client will ALWAYS be able to receive a new access token, so why not have only one?
    Am I missing something here? Should I return to the client only the access token and keep the access token in my database? Otherwise what's the difference from having only one token?

    Thank you very much.

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

    What's the best type of chart to plot out emotions?

    Posted: 03 Jan 2021 03:20 PM PST

    I have a small app that tracks a users emotional intensity before an event and after.

    I want to use chart js, or any other open source javascript graph library, to plot out the before and after intensity of emotions after events over days, weeks, months, years:

    Gist of example json

    The problem is I have over 50 emotions, the chart should reflect the before and after emotions, and there could be multiple events a day. I'm not sure what type of chart to use to explain this: bar, line, etc. I started giving emotions parent emotions to try and cut down on the amount that would need to be charted. I'm wondering if the easiest way would just be to create a line chart for each parent emotions before and after.

    Note: It's been 10 years since I've done any math at all. So I might ask to ELI5

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

    API/Client confusion

    Posted: 03 Jan 2021 03:18 PM PST

    Hi all,
    I'm a long time database developer who is recently strolling into the land of java and web api development. I'm struggling a bit with some concepts and was hoping the community might be able to steer me the right direction.
    I've dabbled a tiny bit with creating a RESTful API in Ruby and Rails before. Brand new to Java. I've been tasked by my employer with creating an API solution using JAX-RS and Eclipse.
    We are creating our own RESTful API that will need to communicate with other third-party APIs to GET/POST data back and forth depending on what endpoints of our API are hit. These third-party APIs use Oauth 2.0 for authentication.
    I'm aware how to create a simple RESTful API using JAX-RS that will interact with a system it has direct access to (i.e. a database stored on/accessible to the local server). I'm somewhat understanding how to create a client application that will make a request to an API end point (third-party or otherwise).
    Where I'm getting confused:
    Is it easy enough to have an API endpoint that when called will act as an application and make a request to another API? I'm seeing many examples online of an application calling an API. Having a hard time finding the inverse. I'm sure this is something basic that's just not "clicking".
    Appreciate any helpful information and/or links/resources.
    Thanks!

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

    How do you add a posting system when making a subreddit

    Posted: 03 Jan 2021 02:27 PM PST

    Streaming files in C

    Posted: 03 Jan 2021 11:39 AM PST

    I have a program that streams data into a binary file. I want my program to read that file as it is being created and to not close the file until the original program as also closed the file.

    Is this possible? I can not modify the program that writes the binary file which is why I am making a translator.

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

    How do Emails servers works?

    Posted: 03 Jan 2021 07:29 AM PST

    I've been trying to have some knowledge on the Bulk email domain but during my researches, I've found that you can use only know SMTP servers like Gmail and Yahoo, so this may be stupid but I want to create a local email server and use it a public.

    I've some Python knowledge if this may help

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

    Need Help with Python Tkinter / PyQt5 GUI program

    Posted: 03 Jan 2021 10:01 AM PST

    Here is the link to the code and problem description

    https://stackoverflow.com/q/65552542/14098322

    Basically, the whole application malfunctions and gets deformed when a function creates a widget. Please help!

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

    Need help with macros

    Posted: 03 Jan 2021 09:43 AM PST

    So, I know that macros aren't really programming but I don't have prior experience with cs so I have no idea how to go about it at all. It's essentially to help me register for an already full class if someone were to leave that class. What I want the macro to do is to refresh the page constantly and scroll down to read a text at the bottom (which currently says "closed"). When the text eventually says "open", I want the macro to be able to switch tabs, scroll down, and press the update button on the screen (click). The cursor does not need to move at all for this scenario because I can position it so that it will be right on the update button after switching tabs and scrolling down.

    Is there a software or program that is user-friendly and able to implement this macro?

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

    How to monitor two paths at the same time using the inotify instance?

    Posted: 03 Jan 2021 09:40 AM PST

    In these two functions, I am using inotify instance to monitor the paths and I want to monitor two paths at the same time but after giving the locations of the source and destination, the program gives me a message that Both locations are being monitored but this time the inotifyFunc that I call, does not work and the program closes. I don't why?

    Although I put while(1) loop above read(monitor.fd, monitor.buffer, BUFFER_LEN); also but it had a problem that whenever I enter the source path, it stops there and didn't ask me the destination path. That's why I remove the while(1)

    Is there any other solution to it?

    void inotifyFunc(char *path, uint32_t *maskPtr) { int i = 0; monitor.fd = inotify_init(); if(fcntl(monitor.fd, F_SETFL, O_NONBLOCK)){ perror("inotify not initialized: "); exit(0); } monitor.wd = inotify_add_watch(monitor.fd, path, *maskPtr); if(monitor.wd < 0){ perror("Sorry"); exit(1); } monitor.length = read(monitor.fd, monitor.buffer, BUFFER_LEN); while(i<monitor.length){ struct inotify_event *event = (struct inotify_event *)&monitor.buffer[i]; if(event->len){ if(event->mask & *maskPtr){ if(event->mask & IN_ISDIR){ printf("Directory is created\n"); break; } else{ printf("File is created\n"); break; } } } i+= EVENT_SIZE + event->len; } } 

    Another function

    void monitoringSystem(char *pathname1, char *pathname2){ monitor.mask[0] = ENOENT; monitor.mask[1] = IN_CREATE; printf("Choose the source path: "); scanf("%s", pathname1); inotifyFunc(pathname1, &monitor.mask[0]); printf("Choose the destination path: "); scanf("%s", pathname2); inotifyFunc(pathname2, &monitor.mask[0]); printf("\nBoth locations are being monitored\n"); inotifyFunc(pathname1, &monitor.mask[1]); inotifyFunc(pathname2, &monitor.mask[1]); } 
    submitted by /u/ibilalkayy
    [link] [comments]

    Recompiling android source code into a jar file

    Posted: 03 Jan 2021 09:31 AM PST

    I'm currently working on a project that is importing a jar file that has an old service intent that causes the code to crash. I know I need to decompile the jar file and edit the source code and then recompile, I was able to decompile however the issue is recompiling the source code, I've tried eclipse, intellij and even android studio but have been running into issues, I think I also need to use android studio as it imports android properties. Would anyone happen to have step by step instructions on how to recompile source source into a jar file ?

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

    Is theory important?

    Posted: 03 Jan 2021 08:37 AM PST

    Hey guys. I'm studying JS right now and I'm debating on whether or not I should learn the theory part. I'm taking a course on Udemy and right now there is no coding, only explaining how JS works. Is it fine if I skip this part? Or maybe go back to it later?

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

    Is there a software or backend technology that uses AI for dynamic integration of peripheral hardware (any given HID [keyboards, mice, video editing boards] ) into different software found on a pc?

    Posted: 03 Jan 2021 08:08 AM PST

    Say you have a new MIDI device or video/photo or timeline editing device. And it just works with photoshop, but maybe also an IDE or web browser, volume control, random third party little known industry specific software. And it works with almost any software because of an integrated AI not only identifying common inputs mapped from typical commands translated from a program mapping it to the keyboard, but also finding typical software specific commands or operations and mapping them intuitively to the new device.

    This seems like it's something already partially done by current protocols in place for peripheral devices, so I'm mainly talking about seemingly flawless adoption of new software products to new peripherals or Human interface devices.

    Is there anything close to that?

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

    Programing with Apple Music API

    Posted: 03 Jan 2021 07:06 AM PST

    This is my idea:

    I want to create program that uses the Apple Music API. I want it to look at a set of Apple Music playlists each week, copy the top five results of each and put them all into a playlist. I want it to also create a list of all the songs that it adds to this list.

    Then the next week I want it to clear the playlist, look at that same set of playlists, compare it to the list of all songs added, and only add the song to my playlist that have not been added yet.

    I want to know if this is possible using the Apple Music API, what language it should be written in, and what cost is associated with accessing the Apple Music API.

    This would just be for personal use. I know very little about coding and would want someone to make this for me. I have already submitted this to Fiverr. I want to know what type of an undertaking this would be.

    Is there anything else I am not thinking about or should consider?

    Thanks.

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

    Building A Pokedex Application

    Posted: 02 Jan 2021 11:26 PM PST

    Hello everyone, I would like to build a pokedex application using C# WinForm.

    I would like to deploy it as an offline application. I'm currently using MySQL as database. I would like it to share it with my friends and client without relying in MySQL is there any other options? I'm new to this

    submitted by /u/Clerk-Long
    [link] [comments]

    Custom map library recommendations

    Posted: 03 Jan 2021 05:08 AM PST

    Hi guys,

    Stack overflow decided to reject my question so I've come to you.

    I've decided to make my own variation of conway's game of life because I couldn't find any that I liked.

    I want to be able to move around and zoom in and out to view a larger part just like you would on a map on web application. My first idea was to program the movement myself and render it with a lightweight webGL library (pixiJS) however this poses some problems as this method will only allow me to zoom out to an extent and I'm not interesting in coding my own anti-aliasing function.

    I just want to know if there's something already out there before I reinvent the wheel.

    Thanks :)

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

    No comments:

    Post a Comment