• Breaking News

    Saturday, May 1, 2021

    PostgreSQL procedures vs cloud functions? Ask Programming

    PostgreSQL procedures vs cloud functions? Ask Programming


    PostgreSQL procedures vs cloud functions?

    Posted: 01 May 2021 05:36 PM PDT

    Hello, I am new to sql and I've only have experience with noSQL, I use noSQL such as firebase with cloud functions, to act as a server. This way I have HTTPS secured endpoints and a database without the hassle of starting and configuring my own server.

    But a new service called SupaBase uses postgres sql. And I am thinking about switching.

    Question:

    Let's say I'm making a game and there's simulation logic/ validation logic that requires me to pull data from database a few times and then proceed to do logic, and post it back. This code should be in my cloud functions right? But if it's in procedures it'll be faster. Does that mean with postgres procedures, cloud functions are pretty much "useless" for the most part?

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

    With which programming languages do we find a wide range of free hosting services for restful apis ?

    Posted: 01 May 2021 06:21 PM PDT

    For example, I know just some basics in php, and you can find free (with ads) hosting services anywhere, although I don't know if "hosting some page.php with some code" is considered a restful api service..

    With java I think you pretty much need a vps and put your spring boot apps somehow somewhere

    What about python or nodejs, or any other ? I'm considering starting a draft small project but without giving away credit card info just for a trial or some unknown vps service

    Thx!

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

    Can I become a programmer?

    Posted: 01 May 2021 08:41 AM PDT

    I'm working as a web developer for 3+ years and now I switched to more complicated area - mobile games (Crodova + TS and etc.). I've read a lot of articles like "Who is the best programmer" or "Test your skills" unintentionally - just while browsing Internet. And a lot of facts tell that you must code for nights, must be obsessed with coding and IT overall to became a master, dedicate your life to it and so on. And I think - is it actually so? I like to code, to read professional articles/books and looking for new areas. I like to solve non-trivial or complex, hard tasks. Also I like maths/physics but I'm pretty bad at thinking this way. I like to create architecture, think in perspective about what would it lead to. But I'm too lazy and it's pretty often that I'm playing games or watching series instead of learning something new despite that I enjoy coding/learning. And sure - I respect my time and I'm not going to spend hours of sleepless time to solve the problem. I'd rather do it tomorrow or in the morning. Do I have any chances to became a senior at complicated areas like machine learning/sofware engineering or staying as middle is what I can do at most? I want to know your opinions

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

    Not sure if this is the right place to post but I desperately need help

    Posted: 01 May 2021 09:13 PM PDT

    Basically I have an assignment that I'm about 80% to completion on but for the life of me I can't get the last row down. I need to input from a file the city names and the 24 values (temperatures) under each city than calculate the mean and standard deviation for each cities temperatures. However, I also need to calculate the average temperature for every hour across all cities (for example, calculate the average of the first hour for 3 cities) and I need to post this into a fourth row. I will post my code below, but I can't grasp how to calculate across the rows, only the columns. Thanks for any help in advance.

    #include <iostream>

    #include <fstream>

    #include <iomanip>

    #include <cmath>

    using namespace std;

    class CityTemps

    {

    public:

    // Create functions to both set and get country, city, temperature, mean, and standard deviation

    void setCountry(string newCountry)

    {

    country = newCountry;

    }

    void setCity(string newCity)

    {

    city = newCity;

    }

    void setTemperatures(double newTemperature[24])

    {

    for( int i = 0; i < 24; i++)

    {

    temperature[i] = newTemperature[i];

    }

    }

    string getCountry( )

    {

    return country;

    }

    string getCity( )

    {

    return city;

    }

    double getTemp(int hourPar)

    {

    return temperature[hourPar];

    }

    double getMean( )

    {

    mean = calculateMean( );

    return mean;

    }

    double getStandardDeviation( )

    {

    standardDev = calculateStandardDeviation( );

    return standardDev;

    }

    private:

    string country, city;

    double temperature[24];

    double standardDev, mean;

    double calculateMean( )

    {

    double total;

    double mean;

    for( int i = 0; i < 24; i++)

    {

    total = total + temperature[i];

    }

    mean = total / 24;

    return mean;

    }

    double calculateStandardDeviation( )

    {

    for(int i = 0; i < 24; i++)

    {

    standardDev = standardDev + pow((temperature[i] - mean), 2);

    }

    return sqrt(standardDev / 24);

    }

    };

    CityTemps readCityData(ifstream& tempFile);

    int main()

    {

    int numberOfCities;

    CityTemps cities[5];

    ifstream inStream;

    inStream.open("CityTemps.txt");

    cout.setf(ios::fixed);

    cout.setf(ios::showpoint);

    inStream >> numberOfCities;

    for(int i = 0; i < numberOfCities; i++)

    {

    cities[i] = readCityData(inStream); // function return will be an object with data

    }

    cout << std::left << std::setw(6) << "Hour";

    for(int i = 0; i < numberOfCities; i++)

    {

    cout << std::right << std::setw(10) << cities[i].getCity();

    }

    cout << std::right << std::setw(10) << "Average\n";

    for(int hour = 0; hour < 24; hour++)

    {

    cout << hour + 1;

    for(int i = 0; i < numberOfCities; i++)

    {

    cout << std::right << std::setw(10) << std::setprecision(1) << cities[i].getTemp(hour);

    }

    cout << "\n";

    }

    cout << "------------------------------------------------------------\n";

    cout << "Mean Temp: ";

    for(int i = 0; i < numberOfCities; i++)

    {

    cout << std::right << std::setw(10) << std::setprecision(1) << cities[i].getMean();

    }

    cout << "\n";

    cout << "Standard Deviation: ";

    for(int i = 0; i < numberOfCities; i++)

    {

    cout << std::right << std::setw(10) << std::setprecision(1) << cities[i].getStandardDeviation();

    }

    cout << "\n";

    }

    CityTemps readCityData(ifstream& instreamPar)

    {

    string country, cityName;

    double newTemperature[24];

    CityTemps city;

    instreamPar >> country >> cityName;

    city.setCountry(country);

    city.setCity(cityName);

    for(int i = 0; i < 24; i++)

    {

    instreamPar >> newTemperature[i];

    }

    city.setTemperatures(newTemperature);

    return city;

    }

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

    In the CS field: is it best to return to an internship if offered, or seek out a new internship?

    Posted: 01 May 2021 04:46 PM PDT

    In the CS field, people advise to not return to internships and try to diversify your experience as much as possible. On the other hand, some mention that returning to an internship (if that experience was positive!) shows commitment, and you are already familiar with the codebase so you work more efficiently and faster. Also you get a pay raise (could be an important factor for some who are struggling).

    What does this community think of this? Is it always a good idea to seek out new internships?

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

    I'm trying to make a full-stack application with React as my front-end, what back-end is the best for fast database access?

    Posted: 01 May 2021 12:28 PM PDT

    I made a React front end and Spring boot java back end, and the communication between the two was often extremely slow, as they communicated through http requests and axios, and then java had to access the MySQL database, so the time added up. What back-end technology would work best for fast processing and db access? I've heard good things about Express.js and Scala

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

    How do you work around or through a patent for your idea?

    Posted: 01 May 2021 10:10 AM PDT

    Hi all. I posted in /r/learnprogramming and was pointed here. It's not programming-specific but programming-related, and it's currently holding up my coding.

    Say you have a brilliant idea. You make a proof-of-concept, it works, hooray. You've conceptualized (you thought) a unique and valuable function entirely by yourself, and you think it will revolutionize how people approach x, y, or z, only to do some quick googling and find that:

    • Xerox patented your idea in 2004
    • Xerox then transferred the patent to a patent troll in the last year
    • said patent troll is now suing Citrix and other large, small, & startup companies for doing basic computer stuff

    It's really deflationary to have an idea for the next big thing only to see that the legal circus was ~10 years ahead of you. I know that a function being patented and code being licensed are two different things. I'm more familiar with licenses than with patents. I'm seeing that my exact idea has been patented and that innovation then completely stopped.

    I'm trying not to get discouraged. I have a handful of ideas and a close relationship with an IP litigator who said I get one free page of questions. How should I approach this?

    TL;DR: someone patented my idea 20 years ago and nothing's happened since - can I build it the same? Can I build it differently? Is this something I should include in my questions for the IP litigator (NOT filing suit, merely asking questions like this) instead of Reddit?

    Thanks in advance,

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

    Tools for coupling requirements to code and tests

    Posted: 01 May 2021 02:57 PM PDT

    Are there tools that couple requirements to code and tests? Best if they are open source. I know a few requirements tools like excel sheets and Jira but they are more like standalone tools. With those you can't tell where the code is, and what tests are done and how tests are written.

    Edit: I work with mostly C++ and C

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

    How much would I pay for someone to build a website with a page like the one below?

    Posted: 01 May 2021 02:55 PM PDT

    If you want to save time, It's a financial screener.

    https://www.serenitystocks.com/screener?field_issuetype_value=2

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

    Visual basics error

    Posted: 01 May 2021 02:33 PM PDT

    I'm a big dummy stoop stoop who is bad at programming and VB is giving me shite on the fifth line of this code. The code is an Excel macro for a combobox called "Countries" to show and hide lines on the chart "Diagram 1", and from my proficient googleing skills it has no right to talk to me like this.

    Pls help. I'm tired.

    Sub HideShowLine()

    Application.ScreenUpdating = False

    Dim i As Integer

    For i = 0 To 203

    If ActiveSheet.Countries.Selected(i) = True Then

    ActiveSheet.ChartObjects("Diagram 1").Activate

    ActiveChart.SeriesCollection(i).Format.Line.Visible = msoFalse

    Else

    ActiveSheet.ChartObjects("Diagram 1").Activate

    ActiveChart.SeriesCollection(i).Format.Line.Visible = msoTrue

    End If

    Next i

    End Sub

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

    Screenshot tool amongst network users

    Posted: 01 May 2021 12:15 PM PDT

    I built a linux tool that allows users to screen grab an area on their desktop, and I would like them to be able to send this screenshot to other users on the network. The program runs in python so if a user receives a screenshot from someone else, I would want a python command executed that would pop up a gui application displaying the screenshot.

    How would this be done? Would the sender have to ssh into the recipients host and execute the python command? I read a little on VNC also and I'm wondering if that would be an option.

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

    Why aren't images being acquired by my analyze() method?

    Posted: 01 May 2021 10:58 AM PDT

    I'm currently working on an Android application (using Java on Android Studio) that captures images from a live camera preview and analyzes/labels them. The two components of the application use a CameraX preview as well as a Google ML Kit Object Detection documentation.

    While the CameraX preview works absolutely fine, the Google ML Kit is where I encounter some challenge. My Google ML Kit Object Detection does not carry out its intended purpose; detecting objects. It does not even process the image within my analyze() method. However, it also doesn't display errors within my Android Studio logcat.

    Out of the 4 steps outlined within the Google ML Kit documentation, Step 2: Prepare the input image & Step 3: Process the image are where I find the problem lies. How do I know this? I added some Log.d("TAG", "onSuccess " + detectedObjects.size()); within my onSuccess method to determine the size of the returned object list, only for the Android Studio logcat to print D/TAG: onSuccess0 upwards of up to 20 times within the span of several seconds of running the application, which means that no data whatsoever is being acquired by the analyze() method.

    Here is the analyze method where the image preparing and processing take place;

    private class YourAnalyzer implements ImageAnalysis.Analyzer { @Override @ExperimentalGetImage public void analyze(ImageProxy imageProxy) { Image mediaImage = imageProxy.getImage(); if (mediaImage != null) { InputImage image = InputImage.fromMediaImage(mediaImage, imageProxy.getImageInfo().getRotationDegrees()); //Pass image to an ML Kit Vision API //... ObjectDetectorOptions options = new ObjectDetectorOptions.Builder() .setDetectorMode(ObjectDetectorOptions.STREAM_MODE) .enableClassification() // Optional .build(); ObjectDetector objectDetector = ObjectDetection.getClient(options); objectDetector.process(image) .addOnSuccessListener( new OnSuccessListener<List<DetectedObject>>() { @Override public void onSuccess(List<DetectedObject> detectedObjects) { Log.d("TAG", "onSuccess" + detectedObjects.size()); for (DetectedObject detectedObject : detectedObjects) { Rect boundingBox = detectedObject.getBoundingBox(); Integer trackingId = detectedObject.getTrackingId(); for (DetectedObject.Label label : detectedObject.getLabels()) { String text = label.getText(); if (PredefinedCategory.FOOD.equals(text)) { } int index = label.getIndex(); if (PredefinedCategory.FOOD_INDEX == index) { } float confidence = label.getConfidence(); } } imageProxy.close(); } } ) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.d("TAG", "onFailure" + e); imageProxy.close(); } } ); } } } 

    mediaImage is not null. The code is being run. My question would pertain to why no data whatsoever is being acquired by this method. Any further information needed to supplement this question will be provided upon request!

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

    Programming languages and/or technologies that are not a nightmare to work with

    Posted: 01 May 2021 03:31 PM PDT

    Hi folks,

    I'm a web developer with some iOS programming experience. I realized there is a lot of criticism about popular programming languages and tech stacks. For example:

    • Web development

      Considered a total mess, ugly junction of pieces glued together. I absolutely agree with that statement.

    • C++

      Another mess, old and ugly, hard to maintain. Used only because of performance and lack of real alternatives.

    • iOS development

      Xcode is a real hell to work with.

    • Java

      Another old, ugly Frankenstein. Not fun to use, lacks in flexibility.

    • Python

      Definitely too slow.

    Does programming need to be a headache? Do you think that criticizing technologies comes from incompetence of a programmer? It sometimes does, sure. But I keep hearing great programmers sharing my views on web development, Xcode and C++. What's your opinion on that?

    And finally, is there any tech stack that is free of these serious flaws? Something that makes programming a beautiful experience, instead of a headache? What I know for sure that web dev and iOS development don't fall in that category, because they are rather fundamentally broken. Web development is broken by design and for iOS development, it's mostly the tools that are making the workflow stressful.

    P.S. Please don't post that silly quote of Bjarne Stroustrup here. I know it and I disagree with it.

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

    Looking for a mentor

    Posted: 01 May 2021 02:55 AM PDT

    Hey everyone,

    This is my first time EVER in my life where im reaching out for help. Im currently a junior in college, majoring in Computer science, only problem is, I feel like I havent learned SHIT compared to what I have seen out there. I have some knowledge in C++, HTML, CSS and JS, but not enough where I feel confident. Ive been looking for courses online to try and better myself as a programmer, but, apperently they all offer the same thing and to be honest, I dont know where to start. Im supposed to have an internship by the end of this quarter and I dont even have that. Im not asking for pity. Simply guidence. I want to focus on CyberSecurity or Also in becoming a full stack developer

    Thanks.

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

    I tried adding array integers but the numbers end up side by side?

    Posted: 01 May 2021 06:23 AM PDT

    First, I made a class with this:

    double perItemCompute()

    {

    total = qty \ price;*

    return total;

    }

    Then the main:

    cout<<"TOTAL:"; for(int i=0; i<10; i++){ double alltotal = 0; alltotal += IR\[i\].perItemCompute(); cout<<alltotal; 

    OUTPUT:

    TOTAL: 40003004000300400030040003004000300

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

    How do I run this code on Java?

    Posted: 01 May 2021 05:50 AM PDT

    int sum(int n) {/*Ex 1.*/ 2 if (n <= 0) { 3 return 0; 4 } 5 return n + sum(n-1); 6 } 

    this is what I got so far:

    public class CTCI { public static int summ(int n) { if (n <= 0) { return 0; } return n + summ(n - 1); } summ(3) } 

    why is this giving me an error? How do I set this up so that it runs?

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

    Any idea if I can loop my class input? thanks!

    Posted: 01 May 2021 04:50 AM PDT

    cinIR1.carNameIR1.qty>>IR1.price;

    cinIR2.carNameIR2.qty>>IR2.price;

    cinIR3.carNameIR3.qty>>IR3.price;

    cinIR4.carNameIR4.qty>>IR4.price;

    cinIR5.carNameIR5.qty>>IR5.price;

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

    Cannot read property 'intent' of undefined

    Posted: 01 May 2021 05:52 AM PDT

    I am trying to make a conversational chatbot using Dialogflow. Below this code is supposed to identify the intent of the entered sentence and return the appropriate answer from the DB. But my code is throwing "Cannot read property intent of undefined", can someone tell me what might cause this? Thank you in advance!

    exports.foodFunction = async (req, res) => { const { MongoClient } = require("mongodb"); const CONNECTION_URI = process.env.MONGODB_URI; // initate a connection to the deployed mongodb cluster const client = new MongoClient(CONNECTION_URI, { useNewUrlParser: true, }); client.connect((err) => { if (err) { res .status(500) .send({ status: "MONGODB CONNECTION REFUSED", error: err }); } const collection = client.db(process.env.DATABASE_NAME).collection("Meals"); var intent = req.body.queryResult.intent.displayName; console.log(intent); let params = req.body.queryResult.parameters; 
    submitted by /u/daddyasha
    [link] [comments]

    How to really convert int to char in CPP in Ubuntu?

    Posted: 01 May 2021 12:51 AM PDT

    int main(){ char s[20]; int sum=11; int count=0; while(sum!=0){ cout<<sum%3<<endl; s[count]=static_cast<char>(sum%3); cout<<s[count]<<endl; sum/=3; count++; } cout<<count<<endl; return 0; } 

    https://ibb.co/tC9dyKH

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

    Extracting discord message (Python)

    Posted: 30 Apr 2021 11:33 PM PDT

    I have been trying to extract messages live from discord. Live need not be real time but 5-10 second delay works. I am not sure how to approach this. I know OCR works but that's too complicated. Is there anything similar to html extracting from websites but for discord?

    I tried to feed the messages into my "notifications" and read off of that. But I'm not sure how to go about any of this.

    If you have some advice, or can point me to the correct resources that would help a ton.

    Thanks.

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

    No comments:

    Post a Comment