• Breaking News

    Sunday, July 14, 2019

    Is there a way to obtain documents from manual references using Spring WebFlux and MongoDB? Ask Programming

    Is there a way to obtain documents from manual references using Spring WebFlux and MongoDB? Ask Programming


    Is there a way to obtain documents from manual references using Spring WebFlux and MongoDB?

    Posted: 14 Jul 2019 08:17 PM PDT

    I'm attempting to create a Spring-Data MongoDB repository using Spring WebFlux for use in my server backend. I'm still very new to Spring-Data overall, and I'm trying to figure out how return a document from a manual reference using only a single GET request to my server.

    For instance, lets say that I have the following document structure for my Person documents:

    { "_id": "123", "person": "Test Person", "address": { "refId": "456", "name": "House" }, "occupation": "Test occupation" } 

    and the following structure for my Address documents:

    { "_id": "456", "street": "Test Street", "houseNumber": "404" } 

    I create a PersonRepository and AddressRepository, extending ReactiveMongoRepository<Person, String> and ReactiveMongoRepository<Address, String> respectively. This is great for when I want to query for individual Person(s) and Address(es), I've tested and it seems to work as expected. My frontend is able to make GET requests to this backend (of the form /person/{id} and /address/{id}) and retrieve the correct data. However, whenever I want to obtain the Address for a specific Person I need to make two GET requests, one to get the Person, from which I parse the specific address "refId", which I then plug into a second GET request to the Address endpoint. While this is logical its an extra GET request to the server, and I'm wondering if there is some way to describe a query in my backend so I can simply make a single GET request to a /person/{id}/address endpoint which finds the Person document with the specified id and returns the Address document from the "refId" in the Person (not the "address" part of the Person document, I want to return the actual Address document).

    There isn't much I have already tried, as I don't have many ideas. Since I'm using Spring WebFlux all of my server responses are in the form of Publishers (Mono/Flux) as that is what the repository returns, and I'm not sure how to work with those before returning them as a ServerResponse object.

    Thank you.

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

    would it be possible to make a program to close and open an app such as spotify or chrome with a hotkey?

    Posted: 14 Jul 2019 07:23 PM PDT

    for example, would I be able to close spotify.exe with F9 and then reopen it either with F9 or another random button?

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

    Binary encoding of variables with given functions

    Posted: 14 Jul 2019 12:44 PM PDT

    I have given functions that I must tackle using binary encoding. However, I have no idea how to approach this.

    For example, " f(x) = x2 Where x is an integer in the range 0-255, i.e., 0≤ x ≤ 255 " is an example of one of the functions.

    Any help would be appreciated.

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

    Java float values

    Posted: 14 Jul 2019 08:29 PM PDT

    I got a few problems wrong on my homework that i don't really understand.

    int iResult, num1 = 25, num2 = 40, num3 = 17, num4 = 5; double fResult, val1 = 17.0, val2 = 12.78;

    iResult = num2 % num3;

    iResult = num3 % num2;

    i don't understand why the answers are 6 and 17. I thought you just divide and get the remainders as 0.35 and 0.42

    Also can you help explain to me what happens when: fResult = (int) ((double) num1 / num2);

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

    Help with constructors!

    Posted: 14 Jul 2019 04:07 PM PDT

    package assignments;

    public class Assignment3 {

    public static void main(String\[\] args) { // The following code should instantiate two Language objects, and print their names. // Debug the Language class so the code in this method works. Language java = new Language("Java"); Language cpp = new Language("C++"); System.out.println(java.getName()); System.out.println(cpp.getName()); } 

    }

    class Language {

    private String name; public Language() { System.out.println("No-arg constructor invoked."); } // Write a constructor that will allow the code in Assignment3.main(String\[\]) to work. public String getName() { return [this.name](https://this.name); } 

    }

    PS Can someone please explain constructors I am having difficulties grasping this concept.....

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

    How to get rid of a loop in a tree

    Posted: 14 Jul 2019 06:05 AM PDT

    Obviously, trees are graphs with no loops, but mine has. How can I get rid of it without duplicating the find leaf, if possible?

    here's the "tree".

    This tree is for representing a list of URLs, and the (*) is a wildcard.

    Thank you!

    EDIT: I actually mean a cycle, not a loop.

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

    Is it immoral to learn C in 2019 due to the rise of Rust?

    Posted: 14 Jul 2019 08:26 PM PDT

    I want to write emulators and interpreters for old hardware and languages and make some low spec novelty devices with microcontrollers.

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

    What’s Your Thought Process When Job Searching?

    Posted: 14 Jul 2019 03:42 PM PDT

    I just finished a five week internship, that was great. I learned a ton, and really feel like I contributed in a positive way. Now that the internship is over I am faced with job hunting. I'm hoping to get some advice from people who were successful in developing a process that helped them find a job, and continue to improve while they searched. So far I've set up a few disciplines to help me along this journey, but I'd love to get feedback on them, and perhaps add some.

    Practices:

    No alcohol until I land a job

    Attend two tech related meetups a week

    Apply for at least one job a day

    Spend at least one hour every other day programming

    Maintain my solid exercise routine

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

    First time compiling Xcode (C++) project, getting "can't open file" errors. I think I have missing libraries and I'm not sure how to proceed.

    Posted: 14 Jul 2019 02:21 AM PDT

    Hey there! I'm usually a python guy and I've never worked with Xcode before, so I'm pretty stuck on this possibly very simple issue.

    I'm trying to build this. I've already added all the OpenFrameworks libs and addons so this projects goes through the most phases of compiling successfully, however I'm really new to xcode and os x, so the error I got really stumped me.

    cp: /Users/c/Desktop/test0/digi_art/art_one_more_layer/digital_art_2014/HandArtwork/bin/HandArtworkDebug.app/Contents/MacOS/libfmodex.dylib: No such file or directory error: install_name_tool: can't open file: /Users/c/Desktop/test0/digi_art/art_one_more_layer/digital_art_2014/HandArtwork/bin/HandArtworkDebug.app/Contents/MacOS/HandArtworkDebug (No such file or directory) cp: /Users/c/Desktop/test0/digi_art/art_one_more_layer/digital_art_2014/HandArtwork/bin/HandArtworkDebug.app/Contents/MacOS/libLeap.dylib: No such file or directory error: install_name_tool: can't open file: /Users/c/Desktop/test0/digi_art/art_one_more_layer/digital_art_2014/HandArtwork/bin/HandArtworkDebug.app/Contents/MacOS/HandArtworkDebug (No such file or directory) 

    I'm pretty sure it's an easy fix, I just have no idea where to start and how to add these missing fmodex and leapmotion libraries. Any ideas?

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

    Issues with C program.

    Posted: 14 Jul 2019 10:19 AM PDT

    Hello all, I'm currently in a C / Unix course for the summer and it's about a 8 week long course vs the standard length, so we're basically doing a lot all at once.

    I know a bit of C++ but that's it.

    I'm running into an issue, where I'm not really understanding how to pass value through a construct in C.

    #include <cstdio> // for printf #include <cstdlib> // for malloc struct ID { char* name; double gpa; unsigned age : 5; unsigned year : 3; }; typedef struct ID ID; ID* constructID(char* name, double gpa, unsigned age, unsigned year); void printInfo(const ID* pt); int main() { ID* st_1 = constructID("", 0.0, 0, 0); printInfo(st_1); printf ("\n"); ID* st_2 = constructID("John Smith", 3.45, 24, 2); printInfo(st_2); printf ("\n"); return 0; } ID* constructID (char* name_val, double gpa_val, unsigned age_val, unsigned year_val) { ID* pt; pt = (ID*)malloc(sizeof(ID)); return pt; } void printInfo(const ID* pt) { } 

    Now in C++, you would just do ID::ID, type of value such as string, double, etc. Pass the value of say name = name_value. Then in the next void you'd just output name.

    However based on what I've been running into, I can't seem to be able to pull string name into char and then pass it to the next void.

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

    Is inheritance used for append-only bugfixes?

    Posted: 14 Jul 2019 11:28 AM PDT

    In large OO systems, is it typical to fix a bug by subclassing the offending class, fixing the bug, then using that subtype for only the instances suffering the bug, relying on polymorphism to keep the difference transparent to other parts of the system? Does these classes end up looking like FrobImpl_iss9021 or something?

    Addendum: I'm not suggesting this would be a good idea,but I imagine it would be tempting to the business to make the smallest change possible.

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

    What's the best programming languages that I can learn to start earning money online?

    Posted: 14 Jul 2019 10:56 AM PDT

    A calculator program that can calculate integer addition / subtraction written using the MIPS assembler.

    Posted: 14 Jul 2019 10:46 AM PDT

    a calculator program that can calculate integer addition / subtraction written using the MIPS assembler. The input is given to the array of Formula char (base address $ s0) in the form of a formula. The null character (\ 0, ASCII code 0) is placed at the end. The calculation result is given to the register $ s1 and the overflow is ignored. For example, if the input is Formula = "100 + 20 + 3", $ s1 = 123, and if Formula = "− 100 + 20-3", $ s1 = −83 is output. The '+' and-in the program are the characters + 'and-, in ASCII respectively, and the ASCII characters are 0..9 are 48 (10), 49 (10) and 57 (10).

     Main: $ s1, $ zero, $ zero add $s2, $ zero, $zero Addi $s3,$zero,1 Addi $t1, $zero,'+' Addi $t2,$zero,'-' Loop: lb $t0,0($s0) Addiu $s0,$s0,1 Beq $t0,$t1,plus Beq $t0,$t1,minus Beq $t0,$t1,Cal Addi $t0,$t0,-48 Mul $ s2, $ s2, $t3 Add $s2,$s2,$t0 J loop End:end Plus: addi $ s4, $ zero, 1 j Cal Minus: addi $ s4, $ zero, 0 Cal: beq $s3,$zero,$s2 Addn: add $s1,$s1,$s2 J Join Subn: add $s2,$s1,$s2 Join : add $s2,$zero,$zero Beq $t0,$zero,End Add $s3,,$s4,$zero J loop 

    However when debugging this code not work, is there wrong part??

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

    Confused about all the different programming languages. I want to make an Iphone app on my pc. Advise me please.

    Posted: 14 Jul 2019 08:47 AM PDT

    Hello!

    I want to leave my current career and be a programmer. It's a big dream but I finally am taking steps to learn this (on my own). The first problem is I have no idea what language I can use to make these apps.

    I would appreciate so much just a little direction on where I should be looking. I have been confused a little on my search, as no search engine option is telling me "This app is the standard" or "learn this app first then learn this".

    So please help lol

    Thank you ahead of time

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

    How to advance?

    Posted: 14 Jul 2019 02:44 AM PDT

    I've been self learning for almost a year and I feel I hit some point where I don't know how to advance anymore. My project ideas that I have require the same knowledge or even less. I want to do new stuff that will challenge and interest me but I don't know what. Has anyone been in this same situation and what can you suggest me to do? I don't want people to list ideas for me but rather where do you find the the stuff that gives you new ideas and pushes you out of boundaries and forces you to learn? Thx

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

    How does linking work in CPP, and why do most class-based languages (like Java) need not have it?

    Posted: 13 Jul 2019 10:03 PM PDT

    I'm aware of the JVM classloader and it's function in the process of linking (in an abstract level), but how does it work between the two in a heightened sense, and does CPP not have that type of architecture, or am I missing something obvious?

    Edit: autocorrect

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

    No comments:

    Post a Comment