• Breaking News

    Friday, December 24, 2021

    Question about pointers in C Ask Programming

    Question about pointers in C Ask Programming


    Question about pointers in C

    Posted: 24 Dec 2021 05:45 AM PST

    I'm learning pointers right now and I have a question

    What does "int *ptri = (int *)-1;" mean. Does negative 1 mean, it's a pointer to a constant (negative 1)? I'm really confused

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

    Help regarding clinical decision tree for for health care workers

    Posted: 24 Dec 2021 09:57 AM PST

    Hey guys, there is a good chance I am asking this in the wrong place. But I am not sure where to ask.

    I want to create a simple decision making tool which allows health care workers to decide whether or not they have to isolate, come to work but get tested or come to work and not get tested for COVID.

    On the front end, the hcw should only have to enter some specific information eg their covid exposure (duration, PPE they were wearing etc). On the back end, I want to be able to modify the decision making based on the ever changing recommendations.

    The tool needs to be something simple that I can use (no background programming).

    Do you guys have suggestions?

    Thank you!

    submitted by /u/Brilliant-Duty2445
    [link] [comments]

    I'm on the foundations of a web dev bootcamp (The Odin Project) and I want to learn Rust

    Posted: 24 Dec 2021 10:16 AM PST

    Hello community!

    I'm a computer engineering student and I'm currently learning web development via The Odin Project.

    I'm interested on web apps, CLI/TUI, WebAssembly and data visualization.

    I have some basic experience with C/C++, MATLAB/Octave, Python and Bash.

    Spent my free time of 2021 learning about Linux, VIM (then nvim with Lua), git, GitHub (doing branches, pull requests, merges), dotfiles, and did a transition from the QWERTY keyboard layout to Colemak (I highly recommend it).

    I want to be a full-stack dev to make personal projects and work with web apps.

    Now I'm interested on Rust too. My career sparked me a certain interest in systems and IoT, also I read about WebAssembly and I use some CLI written in Rust that I love.

    So... My real priority is to work as dev ASAP. I'm on the foundations of The Odin Project (MERN stack). It's so bad if I learn Rust in parallel with the JavaScript bootcamp?

    Thanks for reading.

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

    Why does Autos not show correct names and values during debugging in VS 2022?

    Posted: 24 Dec 2021 09:01 AM PST

    I'm learning about debugging in C with Visual Studio 2022(17.1.0 Preview 1.1)

    The solution configuration and platform are Debug, x86.

    I'm inspecting the values from Autos window during debugging, but it shows wrong name and values in some steps.

    Also, a variable item disappears from Autos. I've checked Locals window at the same time, and it correctly shows them.

    This matter doesn't appear in Visual Studio 2019, Autos correctly shows the names and values in VS 2019.

    I made some comments below code after executing each lines by step into.

    Variable names and values in the comments are written in order from Autos.

    just first, second and final inspection of debugging are correct.

    I couldn't find the reason why it happens.

    Why does Autos not show correct names and values in VS 2022?

    I would appreciate it if you could share with me any sources to understand this matter.

    ```

    include <stdio.h>

    int main()

    { int x, y, z; // Breakpoint. x, y, z have garbage values

    x = 5; // x = 5, y and z have garbage values y = 20; // Name and Value are 5, x = 5, an item disappears z = 3; // Name and Value are 3, y =20, z = 3 z = x + y; // x = 5, y = 20, z = 25 return 0; 

    } ```

    submitted by /u/Dev-Kripke
    [link] [comments]

    Get price of two currencies based on current ratio of two currencies

    Posted: 24 Dec 2021 08:42 AM PST

    Price now

    CAT coin cost 10$

    DOG coin cost 6$

    10 days ago, 50 CAT was bought at $5 each for a total of $250

    Then the 50 CAT was used to buy 125 DOGs for $2 each at a total for 250$ or 50CATs

    Knowing the price now, calculate the average price for cat to dog exchanges for any value of cat and dog exchanged in the past. If it is not possible, state impossible.

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

    Trying to save a ConcurrentQue into SqlLite

    Posted: 24 Dec 2021 04:45 AM PST

    Anyone know how to save a ConcurrentQue into an sqlLite table ?
    SqlLite doesn't support this or any other lists in general- trying to find a way to do so. Thanks

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

    How to prevent duplicate score entries in mongodb

    Posted: 24 Dec 2021 06:00 AM PST

    I am working on an MERN application that would send the scores to the mongodb collection. The schema of the data looks like this.

    [ { UserImage, UserName, UserScore, } ] 

    I would like to prevent duplicate data like same scores from the same user. Also each username is unique as it uses the name associated with their google account so there won't be any common names. Is there any way to do it? Can I modify the rules of my database so that it rejects duplicate scores from the same user?

    Also I am new to reddit so sorry in advance if my question is a bit silly and any help would be appreciated

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

    How would you keep track of a live poker tournament's state?

    Posted: 23 Dec 2021 06:32 PM PST

    I am attempting to create some poker tournament software just for me and my buddies and I am getting hung up on how exactly to keep track of hands, dealer/action position, tables, and tournaments.

    In my eyes there are three things that need to be tracked.

    Hands, which are a subset of Tables, which are a subset or Tournaments.

    I've created the idea of a tournament_registration table that simply stores the account_id of the eager player and the tournament_size of the size of tournament they're after.

    Whenever a new account_id is added to the tournament_registration table for a certain tournament_size, I query the table after the insert to determine if enough players have registered for a certain tournament size.

    That setup seems fairly optimal.

    But when it comes to seating players at a table... I am confusing myself (probably overthinking this) as to how exactly to keep track of hand progression at each table.

    Any help/direction would be greatly appreciated.

    Cheers!

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

    If I had a 1/4 aux to usb-c to connect my guitar to my computer, how would I meaningfully parse this data?

    Posted: 24 Dec 2021 04:20 AM PST

    I want to know the length of a two-dimensional array

    Posted: 24 Dec 2021 01:38 AM PST

    for i in range(height): for j in range(width): array[i][j] = char 

    I puted the values in the array like this

    but I dont konw how to do like this (I want to know length of "i" and "j")

    array[i][j] len(i) , len(j) 
    submitted by /u/User012340
    [link] [comments]

    Why might my homebrew webserver require an explicit 'https' in the URL?

    Posted: 24 Dec 2021 01:19 AM PST

    I'm writing a webserver. Showing it to friends I notice I sometimes have to get them to type https://example.com not just example.com into their browsers for it to work which creates a bad first impression.

    Is there some setting in my domain host I need to change to say 'please direct people, as a default, to port 443 not port 80.'

    Currently unimplemented are: TLS hello requests, alerts, session resumption and GCM padding extensions. Will implementing any of these make the problem go away?

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

    Does putting a div inside a body tags make the body tag the parent element?

    Posted: 24 Dec 2021 12:52 AM PST

    I'm asking this because if it was then setting the height of the div to 100% would give it the height of the body tags right? currently in my code setting the height to 100% doesn't work.

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

    High-level, declarative, systems languages with easy C interop?

    Posted: 23 Dec 2021 08:46 PM PST

    Tried to post this in r/ProgrammingLanguages, but it probably fits better here:

    I've been toying with Haskell for a while and really like the declarative style of it; specifying what to do instead of how to do it (for the most part, anyway). At the same time, I enjoy systems programming and (desktop) app development.

    Got me thinking if there are any high-languages that are declarative with easy C interop so that one could build a bridge between system APIs and high-level, productive development. Concurrency and parallelism are also great bonuses if easily supported!

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

    I don't think I can make a career of programming, I've been working on a project for 2 months min. 8 hrs every day and it killed all my aspirations.

    Posted: 23 Dec 2021 03:11 AM PST

    I've been self-teaching for a year. Now I'm about to finish building a simple webapp for a small business owner relative, no checkout or anything, they just want somewhere to display their collection (they sell expensive, old, used vinyls). His biggest gripe with not having a page for his stuff was that he couldn't properly display and filter and sort his content on fb or ig. Anyway, it's almost done after constantly hitting my head against the wall because it was infinitely harder than I'd thought. I learned more in the last 2 months than the past 6 months of taking my sweet time "learning programming" without actually struggling with a challenging project combined.

    The project hat has fewer features than I had anticipated because I couldn't get the rest to work. Some things are done half assed, and the features that it does have are tested and work flawlessly.

    I used Express, MongoDB (Mongoose ODM), Node, Ubuntu (had to learn some Bash and how to navigate through the os via CL), EJS (server-side rendering), the DOM (JS) and a heap of libs to handle media uploading, compression, etc. I'm bugfixing and error handling and setting up form validations, etc. right now. My relative said he doesn't care about perfection or flashy features, that as long as it works and he can filter and sort his collection for people to see, it's ok. Then people contact him and for purchasing.

    These last 2 months have been so frustrating that I've begun to hate programming the way I hated it when I'd first started learning it. I've come to terms with having to learn something new every day, at least I got a lot better at the things I mentioned that I used on this project; constant errors, the file structure got so big -- even though I like to think I name variables and files pretty good -- that it became a headache going from one file to another to fix that linked issue because I had exported that function to that, things turning out to be a 100 times harder than you anticipated, even the most basic things take hours to make, etc...

    I feel like I'm wasting away and decaying in front of a monitor every day. Basically I wake up with a monitor and go to sleep with a monitor. I can only imagine the problems I'd have to face when I finally get a job. I'm starting to send out my resume now that this project is done, I put it on it. I finally have something to show for. The design isn't too shabby either, it looks nice and modern and has a few creative animations.

    If programming wasn't an aspiration I would spend less than 3 hrs in front of the screen, I've already spent 90% of my childhood and teenage years playing videogames which is one of my greatest regrets. And even now there's no guarantee I'll even find a stupid entry job because there's 200+ people applying to every job I see and the job requirements seem to get bigger and bigger the more things I learn.

    What do you guys think? I already wasted a full year of my life, like literally, not a 2-3 hour per day work, I legit spent 90% of every day for the last year in front of a screen. Yeah, the first 6 months were pretty terrible, I had a hard time wrapping my head around even the most basic programming concepts, but yeah. Should I just quit programming?

    EDIT: i think i worded it wrong, this project didn't take a year. i've been learning programming for a year, the project is 2 months old.

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

    What are great YouTube channels with best quality videos on Programming?

    Posted: 23 Dec 2021 11:04 PM PST

    I would like to know which YouTube channels you guys follow which have great quality products similar to that of paid content. I am not looking for any specific tech. It could be anything related to IT and programming content. Here are few which I follow.

    Blender and Godot => BornCG, BlenderGuru

    Native Android => Mitch Tabian(CodingWithMitch) and Coding in Flow

    Native iOS => CodeWithChris, Sean Allen, Paul Hudson

    Flutter => Codepur(previously known as MtechViral)

    Web Development => FireShip, BitFumes, Classsed

    Php => BitFumes

    Funny Programming Stuff => Ben awad

    Dot net => IAMTimCorey, LesJackson

    Graphql => Apollo Graphql

    Game development => Awesome Tuts

    React Native => William Candillon

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

    Creating a rectangular QR code on Zebra printer

    Posted: 23 Dec 2021 06:48 PM PST

    I am trying to create a rectangular QR barcode on a Zebra printer. The QR barcode is square by default and I cannot seem to make it rectangular. Does anyone have suggestions on this issue?

    Link of what I'm trying to duplicate in Zebra platform: https://imgur.com/a/BaD29bf

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

    I can't get rid of duplicate calendar entries from parsing AirBNB calendar links using syncToken in googleAppScripts

    Posted: 23 Dec 2021 02:33 PM PST

    *

    The purpose of this script is to parse the entries and exits of an AirBNB calendar, and create individual entries on another google calendar. as AirBNB stays on the calendar span across the calendar, making it hard to read when there are multiple houses.

    The script repeats on a six hour timer. It creates house check ins/checkout on the a separate calendar fine, but randomly duplicates certain entries and exits. I suspect the something changes on the airbnb calendar that causes it find a new false entry each time.

    Retrieve and log events from the given calendar that have been modified since the last sync. If the sync token is missing or invalid, log all events from up to a month ago (a full sync).

    @param {string} calendarId The ID of the calender to retrieve events from. @param {boolean} fullSync If true, throw out any existing sync token and perform a full sync; if false, use the existing sync token if possible.

    function logSyncedEvents1111A(calendarId, fullSync) { var properties = PropertiesService.getUserProperties();

    // partial sync options var options = { maxResults: 300, // showDeleted:true,

    }; var syncToken = properties.getProperty('syncToken');

    if (syncToken && !fullSync) { options.syncToken = syncToken; } else { // Full sync options options.timeMin = getRelativeDate(0, 0).toISOString(); options.timeMax = getRelativeDate(360,0).toISOString() }

    // Retrieve events one page at a time. var events; var pageToken;

    do { try { options.pageToken = pageToken; events = Calendar.Events.list('*************.import.calendar.google.com', options);

    } catch (e) { // Check to see if the sync token was invalidated by the server; // if so, perform a full sync instead. if (e.message === 'Sync token is no longer valid, a full sync is required.') { properties.deleteProperty('syncToken'); logSyncedEvents1111A(calendarId, true); return; } else { throw new Error(e.message); } } //begin loop through event.items if (events.items && events.items.length > 0) { for (var i = 0; i < events.items.length; i++) { var event = events.items[i]; if (event.status === 'cancelled'){ console.log('Event id %s was cancelled.', event.id); }else if (event.start.date) { // gets start and end dates of calendar event var start = new Date(event.start.date); var end = new Date(event.end.date) CalendarApp.getCalendarById("*********@group.calendar.google.com").createAllDayEvent("IN House adress", start); CalendarApp.getCalendarById("*********@group.calendar.google.com").createAllDayEvent("OUT House adress",end); } } } else { console.log('No events found.'); } pageToken = events.nextPageToken; 

    } while (pageToken);

    properties.setProperty('syncToken', events.nextSyncToken); }

    /** * Helper function to get a new Date object relative to the current date. * @param {number} daysOffset The number of days in the future for the new date. * @param {number} hour The hour of the day for the new date, in the time zone * of the script. * @return {Date} The new date. */

    function getRelativeDate(daysOffset, hour) { var date = new Date(); date.setDate(date.getDate() + daysOffset); date.setHours(hour); date.setMinutes(0); date.setSeconds(0); date.setMilliseconds(0); return date; }

    *

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

    What should I do to make use of my talent in terms of programming?

    Posted: 24 Dec 2021 01:58 AM PST

    Hi, I'm a 15 year-old high-schooler. I found out that I'm "talented" (it's my own opinion, so I would like to know about your opinion) when it comes to Programming

    Here's my skill set:

    -I'm extremely good with math, with a silver medal in SASMO and several other high mathematical competition's certificate. I can score straight As in all science subject without much efforts

    -I can learn almost everything instantly, for example I saw people talk about linked list, I just google it, maybe a YouTube tutorial, and just understand it first try.

    -When I look at a program, I instantly know what code is run behind it, for example, when I look at snake game, I instantly know how to code it out. Or for example, in rocket league, how to determine the ball is in the hoop, I just know the process on how to determine it. (these are just some simple example, nothing impressive tbh, just I think it's a good skill to have)

    -I know how to optimize a program very well. For example, instead of looping thru calculations, I can just wrote a mathematical formula, that can instantly give the result instead of looping thru some simple calculation 100,000,000 times. (No, I don't mean like looping plus for and then "develop" a formula for something like this XD, I just know some difficult to "equation-ate" stuff, and turning them into equation for a very simple complexity in terms of optimization)

    -I love programming. It's one of my most favorite things to do. It gives me all the freedom to code whatever I want, to make whatever I desire. Sometimes I look at some software of other's company, I can almost immediately know ways to improve them, make then organized, most useful, and features that is a must.

    -I can code in simple yet clear form without making it looks like some math conjecture, providing the best solutions. Instead of writing code, then proceed to add 15 more lines to fix the issue (which I seen some of the tutorial online do), I know how to write short solutions, that just give return the value the way it should.

    -I have really good searching ability when it comes to online. Basically, whenever I face a problem in my program let's say. I know what to search, and I should look for and what is the best solution to it.

    Bonus : (well, I think this part is absolutely useless thing to mention XD)

    -I know three languages, Python, C++ and C# (not so familiar, but it's similar to C++ so I know how to code on it almost immediately after I learn C++)

    -I can type at 120wpm with 100% accuracy (for pure words without symbols), and 90wpm for sentence with capital letters and symbols.

    -I have the ambition to migrate from my country since my country don't really value programmer that much :(, and at the same time improving my own standards since I grew up living in rural areas, and luckily now my family move on to sub-urban, which I have access to a computer and internet to code.

    Now here's my problem, I don't really know what should I do to show the world what I'm capable of, what are the things I can do to improve more? I don't want to waste my time for highschool. And if I'm being wrong about my "talent", please point that out as well! Thanks!

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

    Are user rights system and file attributes defined by OS or by FS?

    Posted: 23 Dec 2021 10:28 AM PST

    Sorry for inaccuracies below. As far as I know: on Windows systems user rights are defined by ACL and files can have attributes such as "system", "hidden" etc. On Linux systems rights and attributes are defined by mask like 0777. Is this implemented by operating system or by file system? Does file attributes can only be on Windows systems or it's specific for NTFS file system? If it depends on FS, then why then can I set mask on NTFS file system from Linux?

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

    DFS

    Posted: 23 Dec 2021 11:49 AM PST

    void DFS (int node, Graph* g){ int num_vertices = g->num_of_vertices; bool static visit [] = {false}; visit[node] = true; set* n = neighbors(node,g); // a set of those nodes which are adjacent to the printf("%d",node); // given node. for (int i = 0; num_vertices > i; i++){ if (set_member_of(i,n)){ // That checks if those elements are in the set n. if (!visit[i]){ DFS(i,g); } } } return; } 

    Here I am trying to implement DFS algorithm in graph. The graph is implemented as array of sets. But my issue is I have to make that boolean array as a static array, otherwise I am not getting those values which isn't right according to DFS algorithm. I am wondering is there any way to implement that DFS algorithm without static boolean array ?

    submitted by /u/rahli-dati
    [link] [comments]

    Can you use Netflix DGS framework (graphql) with AWS lambda?

    Posted: 23 Dec 2021 08:37 AM PST

    I know you can make a serverless springboot app and I know there are other GraphQL frameworks that can use AWS lambda but I can't find anything about Netflix's DGS GraphQL framework for AWS lambda

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

    Can We See Source Codes for Mainstream PC Games?

    Posted: 23 Dec 2021 03:18 AM PST

    I'm wondering if we are able to see the source code of a PC game? I assume we're not because we only have the compiled file, similar to how in order to run a `C` program, we have to translate it to machine code through compilation.

    Is this the right reasoning, and also have there been any known cases where someone could see the source code?

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

    No comments:

    Post a Comment