• Breaking News

    Thursday, April 22, 2021

    What are Apache Kafka and RabbitMQ? Ask Programming

    What are Apache Kafka and RabbitMQ? Ask Programming


    What are Apache Kafka and RabbitMQ?

    Posted: 22 Apr 2021 08:03 PM PDT

    I have a basic understanding of microservices, and I've watched a few videos on Kafka and RabbitMQ but I don't understand the concepts as the tutorials use terminology that is quite advanced and that I don't grasp yet.

    Can someone please explain to me what Apache Kafka and RabbitMQ are, in simple terms? Why do we use them?

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

    A lecturer, on a side note, said that if at all possible, always stay as far away from C and C++ and use other tools instead. Does this make any sense?

    Posted: 22 Apr 2021 07:09 AM PDT

    I'm still fairly new to programming, so I'm just wondering here.

    If I were to build software like, say, Photoshop or Pro Tools, what other options would I have besides C and C++? Aren't the features in C essential to building software from the ground up?

    Thanks in advance!

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

    How to compile a bunch of source code (.cpp, .h, etc) into a usable program?

    Posted: 22 Apr 2021 08:26 PM PDT

    Hi, I am very new to programming. I have a folder with all the source code for a program that I really need to use, but I don't know how to compile all the .cpp and .h files in order to do so. I would really appreciate anyone willing to take a look at the files and help me figure this out :(

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

    DB: store user data encrypted (e2ee), but how to share content?

    Posted: 22 Apr 2021 05:51 AM PDT

    Let's say I have a note taking app that stores the user data end-to-end encrypted. Based on the user's password, I derive a key that I use to encrypt a user-key and store that encrypted key in the database. Upon login, I derive the key again and decrypt the user-key from the database with it. The key is then used to en/decrypt the data.

    I now want to be able to share certain content publicly. Say a user wants to share their notes with someone via a link for example. What approaches (design/implementation) can I take to make this possible? Here are some ideas that I had:

    • Store the content inside the URL itself. Might be OK for a note taking app but with apps that have more data behind them this is probably an ugly solution.
    • Decrypt the data from the user client-side, add it to a public, unencrypted table of the database. Links basically contain an ID to that table.

    Are there other (and especially better) approaches? I tried to google my way around but couldn't find anything that useful (maybe my search terms aren't good enough).

    Edit: Just to clarify: Shared content should be publicly available. Someone with the URL should not have to enter a password.

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

    How to combine a regex, a string, and another regex in javascript?

    Posted: 22 Apr 2021 07:39 PM PDT

    I wanna write a program to see if a string has "("+(target str) in this group+"audio)"

    so I know I'll need .search() and two (.+) surrounding that regex(target str)

    I guess string might need this function to be converted into regex

    function escapeForRegExp(str) { return str.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&'); // (A) } 

    and this

    new RegExp(escapeForRegExp(str), 'i') 
    submitted by /u/hwpcspr
    [link] [comments]

    What's the easiest way to create /convert apps to daemon process in Linux?

    Posted: 22 Apr 2021 07:38 PM PDT

    Is there a simple way to "daemonize" a python app or a golang app, or do these programs have to be linked (built with) the Linux daemon api hooks?

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

    Why there's so much negative opinions on javascript?

    Posted: 22 Apr 2021 08:47 AM PDT

    As the title goes. The post about C/C++ inspired me to ask about your opinions on that one. I think js is often depicted in memes as a worst (rarer best) modern language. Is there really anything wrong with it, compared to for example C# or python? Or maybe quite the opposite - it's your favourite language or it has some unique, but in a positive way, features?

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

    How to create a function plotting library?

    Posted: 22 Apr 2021 06:27 AM PDT

    I'm currenly working with my friends on a web application for creating math quizzes and we want to include a GeoGebra-like applet for creation geometry drawings and function plots. I'm working on the function plotting part and so far I've tried the naive approach of calculating the function value for many values of x (the range depending on the current viewport) and connecting them with a polyline. However, this runs into these issues:

    • For functions with vertical asymptotes like 1/x and tan(x), the plot will be "cut off" at some point and then make a big leap to the other side, creating a noticeable almost-vertical line. This is even more visible when zooming out.
    • I have to recalculate and rerender many values every time the viewport changes, which makes panning and zooming very slow.
    • Functions that jump around a lot, like sin(1/x), are plotted very badly.

    What are the ways that plotting libraries typically deal with these problems? Are there any resources I can learn from?

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

    Open source urban planning libraries/tools

    Posted: 22 Apr 2021 10:37 AM PDT

    Hi! I am embarking in a side project whose aim is to build a free, open source, lightweight, customizable framework for urban planning, but I do not know where to start.

    In practice I want my software to fulfill these requirements: - the user must be able to load geospatial information in a given format, possibly also a simple png map - the gui must allow the user to select which layer to visualize and eventually perform some computation on the backend - aside from a core engine, the design must be modular in nature, so that I can build features incrementally

    Is there any open source framework that does that already? If there isn't, where do you suggest me to start? I can code in java/python/golang

    Disclaimer: I am not afraid of GPL3 licenses and I do not want to monetize the final product. My town is victim of land overusage and I want to provide my policymakers with all the tools available for taking conscious choices.

    Thank you all!!

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

    How is a salt useful if you would have to save it anyway when creating password hashes?

    Posted: 22 Apr 2021 12:25 PM PDT

    Hello, I am learning about password hashing and one topic that comes up often is the use of a salt. The way I see it, the hashing function takes the raw text and the salt as input and gives a different hash for each salt. What I don't understand is how this makes it harder to break a hash. When seeing if a password is correct you rehash it with the password and the salt, but this means that the salt must be stored somewhere, which means that it can be extrapolated just like the hashes. How do salts create harder to crack hashes?

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

    Python list() vs split()

    Posted: 22 Apr 2021 02:10 PM PDT

    In python 3 why doesnt ``` print(string.ascii_uppercase.split())

    print(string.ascii_uppercase.split("")) return the same as list(string.ascii_uppercase) ```

    I expect split() to return a list with no space as the default delimiter, so each letter of the string.
    but it isnt the same. it returns one item, and also returns
    ValueError: empty separator

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

    Creating Replicas for Distrubted Systems?

    Posted: 22 Apr 2021 12:40 PM PDT

    Hello, I'm trying to create replicas of a server to create a distributed key value store that implements various consistency levels such as sequential, linearizability, and eventual. To do this I believe i must create replica servers and pass along writes to the replicas to then read from the original sever.

    How do I go about creating these replica servers? This is in python by the way if that helps.

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

    [Windows Forms Applications] ShowDialog and then closing both forms (application) if DialogResult.Cancel

    Posted: 22 Apr 2021 11:31 AM PDT

    I know there are so many ways to achieve this result, and I've been struggling with most of them for a while now, and I decided to go for simplicity and try this way of doing it but then I became stuck again..

    So what I've tried now is:

    Not changing anything in Program.cs.

    In the MainForm which is given as argument in Application.Run, I made a method which is called from the constructor called ShowForm:

    // In MainForm void ShowForm() { // If the user clicks the 'x' to close the window. if (form2.ShowDialog() == DialogResult.Cancel) this.Close(); } 

    But this will cause an error: Exception Unhandled: Cannot access a disposed object. Object name: MainForm.

    What I want to achieve is that the entire application exits if the user closes form2 instead of pressing the "OK" button.

    I've tried writing Application.Exit(); instead of this.Close() but then form2 is hidden and MainForm is shown.. which is pretty strange I think!

    I would have thought the correct way of writing would be:

    // In MainForm void ShowForm() { // If the user clicks the 'x' to close the window. if (form2.ShowDialog() == DialogResult.Cancel) { form2.Dispose(); this.Close(); } } 

    Because when you close a window by pressing 'x' then it actually only hides the window (source: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.form.showdialog?view=net-5.0)

    Edit: I made some progress on finding out what's going on. I realized this while I was taking a shower. But because I am calling the ShowForm method from the MainForm constructor, the form hasn't finished constructing itself. So, I need to run the this.Close() method from somewhere else than the constructor or ShowForm method.

    Maybe someone can help me with the last step? I'm not sure how to design this. The thought was to Close() the MainForm immediately after form2 returns with DialogResult.Cancel. But it seems like that's not possible?

    Maybe I have to bring up form2 after MainForm has finished it's constructor. So maybe I need to have some kind of mouse-move event on the MainForm which triggers form2.ShowDialog() but that seems like a ugly and inefficient solution. There must be a much better way of doing this.

    Edit 2 (possible solution): I changed the Main method in Program.cs a bit:

    if (form2.ShowDialog() == DialogResult.Cancel) { form2.Dispose(); return; } Application.Run(mainForm); 

    That fixes everything it seems from a first look at it. Makes me wonder a bit why we need Application.Run at all. But yeah, I don't see any problems doing it like this.

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

    Script that will turn resource file into an excel file?

    Posted: 22 Apr 2021 10:20 AM PDT

    Disclaimer: I'm not a programmer at all so apologies if I'm not explaining this right.

    I'm an editor and writer for a computer company. Part of my job is to help edit Text Strings. I usually get the text strings in resource files like .resw and .json. I don't directly edit the resource files myself, rather I send the proposed edits and suggestions back to SW team so that they can evaluate and make the changes on their end.

    What I'd like to do is pull the strings from a resource file and organize them into an excel sheet.

    My goal is to have a column for Key ID and a column for the string content so that from the resource file:

    <data name="KeyIDExample" xml:space="preserve">

    <value>Blah blah blah</value>

    Appears in the Excel as:

    Key ID String
    KeyIDExample Blah blah blah

    Is this possible?

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

    Push --force master nightmares

    Posted: 22 Apr 2021 09:08 AM PDT

    I accidentally worked on the master branch the other day at work and without a thought just attempted a git push.

    It was fortunately rejected, but ever since I've had nightmares during sleep that I accidentally type "git --foce push master", which in turn will delete the previous commits and whatnot.

    What can I do to cope with this? Can I program some lint/script in my command tools that warns/prevents me from doing a stupid mistake in the future?

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

    Suggest me to learn new technologies/ language

    Posted: 22 Apr 2021 01:10 AM PDT

    I am a fresher and joined very good company. Java is the main language used here. But it's been more than 6 months and I don't think I have had growth till now. Worked on some small enhancements and had trainings earlier and few when needed. Now I have been told to debug the applications to get the idea and flow since no other work is assigned. I am done with debugging and there is no other work. I have done a 1 year internship, worked on backend (Node.js) and have learnt a lot and was pretty confident, developed many important services . But now I am not in touch with node.

    As I am not feeling productive for a long time. Can you suggest some things which I can go on to learn. Or how can I start and what are the required skills and technologies in market which will be useful when I switch. What kind of project should I develop? I am eager to learn Full stack. Have no idea about front -end technologies and confused what to choose. Currently I know Java, Java EE and Node.js, Python (basics). Had done projects on Machine Learning. I love Node.js and Java not that much.

    It will be helpful if anyone of you will guide me.

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

    Can't take /? as argument in my batch script

    Posted: 22 Apr 2021 08:23 AM PDT

    I'm trying to make my own batch script, and as part of that. I'm trying to make a help text. So that when you type "myscript /?" it prints out the help text.

    But I can't seem to get it going, this is what I got:

    @ECHO OFF

    if %1%==/? (echo 123) else (echo abc)

    All I get is "/? was unexpected at this time."

    How do I get this going? Thanks!

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

    Suppressing Command Prompt When Running Registry Hack

    Posted: 22 Apr 2021 07:38 AM PDT

    Hi there, I am trying to run the following .reg file that duplicates a file from the Windows context menu. It works, except the command prompt pops up every time it runs and has to be closed manually. Any way to suppress the command prompt here?

    Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Classes\*\shell\Duplicate File] [HKEY_CURRENT_USER\Software\Classes\*\shell\Duplicate File\command] @="cmd /Q /S /V:ON /E:ON /C \"set TIME=%%TIME: =0%% & set DateTimeFn=%%DATE:~10,4%%-%%DATE:~4,2%%-%%DATE:~7,2%%_!TIME:~0,2!-!TIME:~3,2!-!TIME:~6,2! &FOR %%G IN (\"%1\") do copy \"%1\" \"%%~nG_!DateTimeFn!%%~xG\" & pause>nul\"" 
    submitted by /u/no_ur_cool
    [link] [comments]

    Job opportunities for OpenCV?

    Posted: 22 Apr 2021 12:00 AM PDT

    I'm taking OpenCV classes in my college and was just wondering if the current job market in saturated with OpenCV programmers (C++ version). I'm asking this question because OpenCV is really difficult for me right now.

    Like for example I was excited to learn python but then got really turned off when I realized because it's an easy code, people don't really get paid that well. I guess I'll stick with C for now. And for the few people in this sub that's proficient with OpenCV, was it worth it?

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

    Csv file format name help

    Posted: 22 Apr 2021 07:00 AM PDT

    Hello everyone,

    So I need some help figuring out what the official/unofficial name of a csv file format to find good ways to export data to the format. Also to clarify, I don't mean the file extension types, I mean the content within the file.

    The vendor we're working with is asking us to produce a single csv file where there's line type prefixes (that's what I'm calling them) that indicate what data is going to come after the prefix. For some line types, there can be multiple/infinite lines of that type, and they relate to the customer of the preceding lines.

    For example: A, customerID, customerName, Date of birth, B, streetAddress, addressState, B, streetAddress, addressState, C, transactionType, transactionAmmount, transactionDate, transactionCompleted, C, transactionType, transactionAmmount, transactionDate, transactionCompleted, .... Any number of additional C lines

    I'm assuming this is some kind of standard way of doing csv files since it's the second vendor I've seen do ask for it, but I have no clue what this standard is called. If anybody knows what to call it I can at least google to find how best to export the data to a csv, since I'm used to just having multiple files and each housing a specific type of data.

    I also apologize if this isn't the subreddit for this kind of question. If there's a better place to ask then I can go ask there instead! Thank you for your time reading this!

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

    Is there a maximum number of simultaneous connections I can make to an FTP site as anonymous?

    Posted: 22 Apr 2021 06:58 AM PDT

    I'm trying to programmatically automate FTP downloads, and was hoping to download larger files in parallel with multipole open connections, but I don't want to accidentally pass some limit and get IP banned. Is there a maximum number of simultaneous connections I can make to an FTP site as anonymous? Is this a technical limit or one set by the administrators?

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

    Looking for good resources (Youtube, books, videos, etc.) about hardware/firmware coding/QA

    Posted: 22 Apr 2021 06:55 AM PDT

    Greetings!

    At my job I'll be moved to a more QA role (from a SW dev role). We have quite a lot of firmware/hardware in our projects, and so I'm sure I'll have to work on that. However, I never really worked on FW/HW in the past (or studied it), less so doing diagnostics, testing, QA, etc. on them.

    I'm sure I'll get training and supervision, but I'd like to take a headstart and get used to some bigger concepts and the "basics I should know".

    Can anyone share youtube channels, videos, books, resources, blogs, etc. about FW/HW in general, but especially for QA/testing?

    Thanks.

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

    This is probably a stupid question but...

    Posted: 22 Apr 2021 06:09 AM PDT

    UPDATE: I got my answers. Thanks for everyone's help. You guys are amazing.

    In C++, is there a way to assign values to all member variables of an object at once?

    Let's say I have this code:

    class Food { public: string food_name; int num_calories; };

    Food food_list [10];

    Ok, so as you can see, I have an array of food objects already initialized but with no real values. Now I want to add values to one of the food objects. Obviously I could do:

    food_list[0].food_name = "banana"; food_list[0].num_calories = 80;

    That works fine, but it can get messy if I have a lot of member variables. What I really want to do is something like:

    food_list[0] = {"banana", 80};

    Obviously that's syntactically incorrect, but is there a way to do something like this in C++? Can I take an initialized object and assign values to all of its member variables in one line?

    Sorry if this is silly, but I'm very rusty with my C++ and can't find an answer by googling for some reason.

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

    Set Windows Design (Desktop Background) via Powershell

    Posted: 22 Apr 2021 05:56 AM PDT

    Hi,
    currently I am working for a way to deploy a Default Desktop Background via Intune but I still have a problem: All works perfectly, the theme is in the right file, also the picture and is suggested under "Designs" ( settings -> personalization-> designs) but it isn't automatically applied.

    For reference I've used this source: https://oofhours.com/2020/05/18/two-for-one-updated-autopilot-branding-and-update-os-scripts/
    Worked in every possible way perfectly but there were to many functions which we didn't needed so I had to changed it... and now it don't works anymore.

    So my real question: Is there any (simple??) way to set a background/design via Powershell?
    I am a beginner, so I would prefer something easy...

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

    No comments:

    Post a Comment