• Breaking News

    Saturday, March 14, 2020

    C function Ask Programming

    C function Ask Programming


    C function

    Posted: 14 Mar 2020 02:28 PM PDT

    I am trying to make a function which would take 8 highest bits from given int and return a value from 0 - 255

    Here is my code:

    unsigned char find_bits(unsigned int x) { return 0xFF00 & x; }

    But the result is 0 and it should be 18 when I call this: find_bits(0x1234)

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

    Swift: Do you use Storyboards?

    Posted: 14 Mar 2020 09:38 PM PDT

    Hey - wondering what the view is on using storyboards and how to do so effectively? It seems like coding everything programmatically results in a ton of code and there's some middle ground? What have you guys seen from experience in your own projects?

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

    Raspberry Pi Home Security System - Request for Guidance

    Posted: 14 Mar 2020 09:29 PM PDT

    Hello, all.

    I had a quick opinion question regarding a Raspberry Pi/Python based home security system I'm working on. My end goal is to have magnetic door/window sensors being monitored by a Raspberry Pi 4 server. If a window or door is opened while the system is armed it will play an alarm sound to the connected speakers. I would then have Raspberry Pi Zero W powered keypad panels (with LCD screens and a 12 digit keypad) that would allow me to see whether the system is armed or disarmed and allow me to input the passcode to arm or disarm the system. The Raspberry Pi Zero W panels would connect to the Raspberry Pi 4 server over the network.

    I already have a somewhat functional test system running in a single Python script with everything connected to the Raspberry Pi 4 (link below). However, I'm now at a point where I need to figure out how to tie in the Raspberry Pi Zero W keypad panels I would like to integrate over the network. My question for you all is how would you go about implementing the network connectivity portion of this? Should I use something like Node.js with some kind of database? Perhaps the socket module in Python for something low-level? Something else entirely?

    I'm up for any and all suggestions for how to go about this. Please let me know if you have any questions. Thanks in advance!

    Poorly Done Diagram: https://imgur.com/a/AnAVzLt

    Current Working Code: https://github.com/kevbo423/RPHSP/blob/master/Home_Security_System.py

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

    IOS Coding App question from a newbie

    Posted: 14 Mar 2020 12:14 PM PDT

    Hi. My 12-year-old son is getting into coding. He wants an IOS app that can help teach him, and he's asking me to get him a premium subscription to Mimo (M1M0). It's not cheap ($100+/yr), but they have a teaser rate for the first year. Before I plunk down the $ for it, can anyone recommend good alternatives that might be less pricey?

    TIA

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

    Need help verifying why code won't run

    Posted: 14 Mar 2020 08:55 PM PDT

    So I'm trying to run this code and its giving me an error with the f open function on line 39 "too few arguments in function call"

    also says to use fopen_s instead but that didn't work either.

    C code and im using VS 2019

    #include<stdio.h> #include"truck.h" #define _CRT_SECURE_NO_WARNINGS int main() { //declare truck 1 Truck truck1, truck2; strcpy(truck1.make, "Peterbuilt"); // Peterbuilt, Mack, Volvo, Kenworth, International strcpy(truck1.typeOfDrivingLicense, "Class A"); // Class A or B strcpy(truck1.typeOfTransmission, "Automatic"); //Automatic, Manual strcpy(truck1.engineType, "Diesel"); truck1.yearManufactured = 2001; //Year built truck1.numOfWheels = 6; //4,6 truck1.weightEmpty = 25000; //truck empty truck1.weightLoaded = 40000; //truck full truck1.power = 500; //horsepower printf("\n Truck 1"); printf("\n Make: %s \n, License Required: %s \n, Type of transmission: %s \n, Engine Type: %s \n, Year Manufactured: %d \n, Number of wheels: %d \n, Empty weight: %.2f LBS \n, Full weight: %.2f LBS \n, Truck Power: %.2f HP \n", truck1.make, truck1.typeOfDrivingLicense, truck1.typeOfTransmission, truck1.engineType, truck1.yearManufactured, truck1.numOfWheels, truck1.weightEmpty, truck1.weightLoaded, truck1.power); //declare truck 2 strcpy(truck2.make, "Mack"); // Peterbuilt, Mack, Volvo, Kenworth, International strcpy(truck2.typeOfDrivingLicense, "Class B"); // Class A or B strcpy(truck2.typeOfTransmission, "Automatic"); //Automatic, Manual strcpy(truck2.engineType, "Diesel"); truck2.yearManufactured = 2005; //Year built truck2.numOfWheels = 6; //4,6 truck2.weightEmpty = 20000; //truck empty truck2.weightLoaded = 45000; //truck full truck2.power = 550; //horsepower printf("\n Truck 2"); printf("\n Make: %s \n, License Required: %s \n, Type of transmission: %s \n, Engine Type: %s \n, Year Manufactured: %d \n, Number of wheels: %d \n, Empty weight: %.2f LBS \n, Full weight: %.2f LBS \n, Truck Power: %.2f HP \n", truck1.make, truck1.typeOfDrivingLicense, truck1.typeOfTransmission, truck1.engineType, truck1.yearManufactured, truck1.numOfWheels, truck1.weightEmpty, truck1.weightLoaded, truck1.power); // writing to file char fileName[30] = "truck.dat"; // File pointer FILE* fp; // open file for writing in binary mode. "wb" - write binary fp = fopen(fileName, "wb"); // check if open is successful if (fp != NULL) { //write truck 1 fwrite(&truck1, sizeof(Truck), 1, fp); //write truck 2 fwrite(&truck2, sizeof(Truck), 1, fp); } // close file stream fclose(fp); // // read the file to test whether write was successful // Truck truck_1, truck_2; // open file in binary read mode fp = fopen(fileName, "rb"); if (fp != NULL) { // reading the struct value written in to file fread(&truck_1, sizeof(Truck), 1, fp); fread(&truck_2, sizeof(Truck), 1, fp); } fclose(fp); printf("Truck 1: "); printf("\n Make :%s", truck_1.make); printf("\n License Required :%s", truck_1.typeOfDrivingLicense); printf("\n Type of transmission :%s", truck_1.typeOfTransmission); printf("\n Engine Type :%s", truck_1.engineType); printf("\n Year Manufactured :%d", truck_1.yearManufactured); printf("\n Number of wheels :%d", truck_1.numOfWheels); printf("\n Empty weight :%.2f", truck_1.weightEmpty); printf("\n Full Weight :%.2f", truck_1.weightLoaded); printf("\n Truck Power :%.2f", truck_1.power); printf("\Truck 2: "); printf("\n Make :%s", truck_2.make); printf("\n License Required :%s", truck_2.typeOfDrivingLicense); printf("\n Type of transmission :%s", truck_2.typeOfTransmission); printf("\n Engine Type :%s", truck_2.engineType); printf("\n Year Manufactured :%d", truck_2.yearManufactured); printf("\n Number of wheels :%d", truck_2.numOfWheels); printf("\n Empty weight :%.2f", truck_2.weightEmpty); printf("\n Full Weight :%.2f", truck_2.weightLoaded); printf("\n Truck Power :%.2f", truck_2.power); system("pause"); return 0; } 
    submitted by /u/jorge407
    [link] [comments]

    First time working with HTML - trying to customize a script based on a GitHub guide for a ranked "favorites" picker, cannot seem to get filter portion of the script to function. (Links and code portions provided)

    Posted: 14 Mar 2020 07:39 PM PDT

    Hi there! I'm coming in with zero experience doing anything like this so I appreciate your patience and assistance with this.

    I'm working off of this guide to create a favorites picker for Animal Crossing villagers. You can see a working version of this for picking one's favorite pokemon off of this website: https://www.dragonflycave.com/favorite.html

    I progressed in the guide far enough that I could get my own custom items in there (the "basic customization" section) and have the picker work perfectly fine when I opened it up. (Still need to get images in there and alter the UI, but that's an issue for another day...)

    The issue arises when I get to the "intermediate customization" section here when trying to implement a filter.

    I've gotten the body of the page to display the following just fine for checkboxes and such for all three categories I'm trying to create filters for (Gender, Personality, and Species):

    <p>Include Personalities: <label><input type="checkbox" name="personality" class="personality" value="Normal"> Normal</label> <label><input type="checkbox" name="personality" class="personality" value="Peppy"> Peppy</label> .... </p> 

    I have items defined as such (again, works fine before attempting to implement filter functionality):

    var items = [ // Define your items here {id: '001', name: 'Isabelle', species: 'Special', gender: 'Female', personality: 'Special', image: '001.png'}, .... {id: 'W50', name: 'Tasha', species: 'Squirrel', gender: 'Female', personality: 'Snooty', image: 'W50.png'} ]; 

    The trouble comes with the 'myPicker' and 'pickerUI' variables in my altered script. I'm comparing this to the section in the guide I was following and I'm failing to see what I am doing wrong.

    var myPicker = new picker.Picker({ item: items, localStorageKey: 'picker-state', defaultSettings: { maxBatchSize: 20 gender: ['male', 'female'], personality: ['Normal', 'Peppy', 'Snooty', 'Uchi', 'Lazy', 'Jock', 'Cranky', 'Smug', 'Special'], species: ['Alligator', 'Anteater', 'Bear', 'Bird', 'Bull', 'Cat', 'Chicken', 'Cow', 'Cub', 'Deer', 'Dog', 'Duck', 'Eagle', 'Elephant', 'Frog', 'Goat', 'Gorilla', 'Hamster', 'Hippo', 'Horse', 'Kangaroo', 'Koala', 'Lion', 'Monkey', 'Mouse', 'Octopus', 'Ostrich', 'Penguin', 'Pig', 'Rabbit', 'Rhino', 'Sheep', 'Special', 'Squirrel', 'Tiger', 'Wolf'] }, shouldIncludeItem: function(item, settings) { return settings.species.indexOf(item.species) !== -1 && settings.personality.indexOf(item.personality) !== -1 && settings.gender.indexOf(item.gender) !== -1 ; }); var pickerUI = new PickerUI(myPicker, { elements: { pick: "#pick", pass: "#pass", undo: "#undo", redo: "#redo", reset: ".reset", evaluating: "#evaluating", favorites: "#favorites", settings: { maxBatchSize: '#max-batch-size', gender: '.gender', personality: '.personality', species: '.species'; } } }); 

    When I use the above code, the option to actually select any items completely disappears!

    If anyone can point me in the right direction - either correcting my code, providing a resource I can use to understand these variables better, or just pointing out something stupid and obvious in the guide I'm missing, I'd greatly appreciate it!

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

    Big O rule #4

    Posted: 14 Mar 2020 03:39 AM PDT

    Hello folks, I was wondering anyone could explain to me in simple terms what the big o notation rule #4 means (drop non dominant terms)? Thank you.

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

    Why does JavaScript need objects when that sort of information can be handled by databases?

    Posted: 14 Mar 2020 07:31 PM PDT

    The title.

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

    Forms to Monday.com

    Posted: 14 Mar 2020 05:42 PM PDT

    Hey guys, a little background story for you all, I'm a university student with very little knowledge of programming, mainly VBA and MATLAB, but also a little html, python and Javascript. I don't know if you're all familiarized with monday, but it's basically a team management tool. I've been using it to organize my student association tasks and to make sure no one gets lost.

    We recently started a project where people have to fill out googleforms and I'm in desperate need of figuring out a way to automatically send the filtered info from the forms to the monday platform. I am aware that I'll probably require a database to gather the info besides those two. Monday has an API called graphql, but it's still in it's beta testing period and idk if I can use it

    Idk what else might I need to explain besides that, but don't hesitate to message me if you need to know more stuff.

    I have a lot of free time rn, due to covid-19 quarantine reasons

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

    Python - better way for image manipulation?

    Posted: 14 Mar 2020 05:29 PM PDT

    I'm trying to animate a photo - it's a simple scroll animation that goes from one side of 3840x1080px photo to another.

    What I'm now doing is use imageio to read jpg into 3840/1080/3 matrix,and then populate 1920/1080/3 matrix by using a for loop that goes through each element + certain number of pixels in width for next frame.

    This works perfectly,but takes about 20 mins on my ryzen 3 1300x.

    Is there any faster way to do this "from scratch"?

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

    (JavaFX) having issues with updating total price labels when removing product from cart

    Posted: 14 Mar 2020 02:05 PM PDT

    hi, i am making a menu ordering system , i have a tableview with some food with their prices. i also have some labels with the total price. i also have a separate listview which contains the foods that they have chosen.

    one issue i have is that when they want to remove a food, it will update the price based on whats selected in the tableview, not the list view

    e.g. Food1 = £2 - Food2 = £5 i have selected one of each, the total price is £7, i click on food1 to remove it but because my selection on the tableview is still on food2, it will take away £5 when it should recognise ive selected food1 and minus £2

    how could i fix this?

    is there a way to look at what i have selected in the listview and use that to find the appropriate row in the tableview?

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

    Using @SecondaryTables to display all data from beers table, categories table and styles table

    Posted: 14 Mar 2020 01:48 PM PDT

    I put the question on StackOverflow, when I tried to put it here it ruined the format if you could check it out in this link that would be great. To give insight on what the question is about, it is about using the Secondarytables annotation to map 3 tables in the JPA.

    Any help is appreciated, you can answer here or StackOverflow, I check each regularly.

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

    Syntax Error: Unexpected Token 'if' (Javascript)

    Posted: 14 Mar 2020 02:26 PM PDT

    I am writing this program in Javascript and It keeps giving me this error. PS I would post to stackoverflow but I can't post for 6 days.

    Code:

    var i =

    if (i = null) {

    console.log('ERROR: NO INPUT');

    }

    else {

    console.log(i);

    }

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

    I feel embarrassed to say I'm a programmer

    Posted: 14 Mar 2020 10:38 AM PDT

    I am a CS student and roughly spent a year learning to code. I'm mostly into web development. I know JavaScript, Python and their frameworks like React and Django. But, every time I have to solve a unique problem using my programming knowledge, I get lost and can only get a solution after doing a google search about almost everything. Because of this, I can't start to write the first line of code for my next projects which I already sketched in my mind. It's not like I don't know jack shit about the coding solution. But, I feel like having all the ingredients to make a recipe but don't know how to make it. Is there anything I can read, watch to get knowledge about building problem-solving skills or what am I actually missing despite knowing programming fundamentals?

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

    [JS] Why is async better than sync?

    Posted: 14 Mar 2020 07:46 AM PDT

    Everywhere you go, people say that you gotta always and forever use async because it's so good and this and that and god forbid that your 1kb .json file takes more than 1 picosecond to save and load.

    Like, I get it that people use it to save stuff in the background, but shouldn't that depend on the size of the project?

    Why should anyone deal with error fetching, exceptions, try-s, "promises", and such stuff when you can just write your code line by line and know that it will execute that way.

    Is there any other valid use-case for async stuff than being able to save and load stuff "dynamically", "on-the-fly", which is, let's be honest, fluff, and not some bare necessity.

    My focus are desktop apps without internet connection (classic "programs"), so if you could focus on that part in your explanations, that'd be great.

    Tnx!

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

    Guys i need help

    Posted: 14 Mar 2020 07:15 AM PDT

    So im new in python I downloaded "Thonny" And start testing something's and i got error in:

    x = input() If x == 2: Print("hi")

    Problem is that when i give type in 2 (so now x = 2) Nothing gets printed. Can anyone explain it to me?

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

    What is the best coding language for pattern recognition?

    Posted: 14 Mar 2020 10:04 AM PDT

    I want to code a program for pattern recognition that can take a long string of numbers and look for a pattern and then calculate how often certain numbers show up in certain parts of a sequence. What would be the best language to write this in?

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

    Understanding XML Element Types

    Posted: 13 Mar 2020 10:17 PM PDT

    Having issues using a vendor soap web service and they supplied an example of a fix similar to the xml below. The integer value was coming back with a unserializable error. They said I need to set the type to int with xsi:type="a:int". In my code I have a series of classes built from their wsdl. I am able to set type="int" using something like myReqObject.$TypeInterface.setAttributes("type","int"), but that doesn't work. So I think I need to get it to match theirs exactly, but I don't quite understand xsi:type="a:int". I am using Gosu, which is pretty much Java.

    <?xml version="1.0"?>
    <Envelope xmlns:xsi="\[http://www.w3.org/2003/05/Soap-Interface\](http://www.w3.org/2003/05/Soap-Interface)">
    <Body>
    <Person>
    <Age xsi:type="a:int" xmlns:a="http://www.w3.org/2003/05/XMLSchema">50</Age>
    </Person>
    </Body>
    </Envelope>

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

    Do the WebViews inside the Reddit mobile app contain a unique identifier I can check for?

    Posted: 14 Mar 2020 01:48 AM PDT

    I'm running into a CSS bug that only happens when my web site is loaded within the Reddit mobile app. I'd like to apply a CSS patch that only applies to Reddit app WebViews. Do the WebViews inside the Reddit mobile app contain a unique identifier I can check for? I inspected their userAgent string and I see nothing unique about it...

    Also, if there is a more appropriate subreddit for this question I would appreciate if someone could point me in the right direction. Thank you!

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

    Beginner on ussing clases Pt.3 (This is not Stack Overflow thank God)

    Posted: 14 Mar 2020 09:17 AM PDT

    So guys today I share you my code for placing info about a student and it's average GPA with last 20 grades that you get on input (0 to 100 scale) here's the deal, I got a calc method that returns float type that is supposed to approve the student with a percentage curve, but there's a little surprise for you in the int main that is located right in the if section when I call for the method p1->apruebaconcurva(porcentaje), you guys give me any idea for why my float calc method is getting called as a boolean: #include<iostream>

    #include<sstream>

    using namespace std;

    class Estudiante {

    private:

    string ID; string Nombre; int FechaNacimiento\[3\]; int anoingresoUNA; int grupoEIF200; float calificaciones\[20\]; 

    public:

    //No parameters Estudiante() { for (int i = 0; i < 20; i++) { calificaciones\[i\] = 0; } ID = ""; Nombre = ""; FechaNacimiento\[0\] = 0; FechaNacimiento\[1\] = 0; FechaNacimiento\[2\] = 0; anoingresoUNA = 0; grupoEIF200 = 0; for (int i = 0; i < 20; i++)calificaciones\[i\] = -1; } 

    //Parameters Estudiante(string cedula, string Name, int Dia, int Mes, int Ano, int entrydateUNA, int EIF200group) { ID = cedula; Nombre = Name; FechaNacimiento\[0\] = Dia; FechaNacimiento\[1\] = Mes; FechaNacimiento\[2\] = Ano; anoingresoUNA = entrydateUNA; grupoEIF200 = EIF200group; for (int i = 0; i < 20; i++)calificaciones\[i\] = -1; } 

    //Set void setID(string cedula) { ID = cedula; } void setNombre(string Name) { Nombre = Name; } void setFechaNacimiento(int Dia, int Mes, int Ano) { FechaNacimiento\[0\] = Dia; FechaNacimiento\[1\] = Mes; FechaNacimiento\[2\] = Ano; } void setAnoIngresoUNA(int entrydateUNA) { anoingresoUNA = entrydateUNA; } void setGrupoEIF200(int EIF200group) { grupoEIF200 = EIF200group; } void setCalificaciones(int prueba, float nota) { calificaciones\[prueba\] = nota; } 

    //Get string getID() { return ID; } string getNombre() { return Nombre; } int getFechaNacimiento(int DiaMesAno) { return FechaNacimiento\[DiaMesAno\]; } int getAnoIngresoUNA() { return anoingresoUNA; } int getGrupoEIF200() { return grupoEIF200; } float getCalificaciones(int prueba) { return calificaciones\[prueba - 1\]; } 

    float promedioCalificaciones() { int pr20 = 0; float pr = 0; while (pr20 < 20) { pr = pr + calificaciones\[pr20\]; pr20++; } return pr / 20; } //If /\*bool aprobo(float promedioCalificaciones) { if (promedioCalificaciones >= 7.0) { return true; } else { return false; } }\*/ 

    //Ternary Operator /\*bool aprobo(float promedioCalificaciones) {(promedioCalificaciones > 7.0) ? true : false; };\*/ 

    //Standard bool aprobo() { return promedioCalificaciones() >= 70; } bool apruebaconcurva10pct() { return promedioCalificaciones() \* 1.1 >= 70; } float apruebaconcurva(float porcentaje) { float promedio; promedio = promedioCalificaciones(); return promedio + promedio \* porcentaje / 100 >= 70; } string comolefue() { if (promedioCalificaciones() >= 90) { return "excelente"; } else if (promedioCalificaciones() >= 70) { return "aprobo"; } else { return "reprobo"; } } 

    string provinciaNacimiento() { switch (ID\[0\]) { case '1': return "San Jose"; break; case '2': return "Alajuela"; break; case '3': return "Cartago"; break; case '4': return "Heredia"; break; case '5': return "Guanacaste"; break; case '6': return "Puntarenas"; break; case '7': return "Limon"; break; default: return "Otro"; break; } } 

    };

    int main()

    {

    string ID, nombre = " ", comolefue, yes\_no; int Dia = 0, Mes = 0, anoingresoUNA = 0, Ano = 0, grupoEIF200 = 0, FechaNacimiento\[3\]; float nota, promediocalificaciones, porcentaje = 0 ,notafinal; Estudiante\* p1 = new Estudiante(); cout << "---------------------------ESCUELA DE INFORMATICA DE LA UNIVERSIDAD NACIONAL---------------------------------------\\n\\n"; cout << "Digite el Nombre del Estudiante: "; cin >> nombre; cout << "\\nDigite el numero de Cedula del usuario: "; cin >> ID; cout << "\\nDigite la fecha de nacimiento empezando por el dia: "; cin >> Dia; FechaNacimiento\[0\] = Dia; cout << "\\nMes: "; cin >> Mes; FechaNacimiento\[1\] = Mes; cout << "\\nAno: "; cin >> Ano; FechaNacimiento\[2\] = Ano; cout << "\\nDigite el Ano de Ingreso a la Universidad Nacional: "; cin >> anoingresoUNA; cout << "\\nDigite el numero de grupo de la escuela de informatica del estudiante: "; cin >> grupoEIF200; system("CLS"); cout << "digite los siguientes 20 resultados del estudiante durante el ciclo anual: "; for (int i = 0; i < 20; i++) { cin >> nota; p1->setCalificaciones(i, nota); } system("CLS"); p1->setNombre(nombre); p1->setID(ID); p1->setFechaNacimiento(FechaNacimiento\[0\], FechaNacimiento\[1\], FechaNacimiento\[2\]); p1->setAnoIngresoUNA(anoingresoUNA); p1->setGrupoEIF200(grupoEIF200); p1->apruebaconcurva(porcentaje); promediocalificaciones = p1->promedioCalificaciones(); comolefue = p1->comolefue(); cout << "Nombre del estudiante: " << nombre << endl; cout << "Numero de Identifiacion: " << ID << endl; cout << "Provincia de nacimiento: " << p1->provinciaNacimiento() << endl; cout << "Fecha de Nacimiento: " << FechaNacimiento\[0\] <<"."<< FechaNacimiento\[1\] <<"."<< FechaNacimiento\[2\] << endl; cout << "Fecha de Ingreso: " << anoingresoUNA << endl; cout << "Numero de Grupo: " << grupoEIF200 << endl; cout << "Promedio de notas: " << promediocalificaciones << endl; cout << "condicion del estudiante: "; if (p1->aprobo()) { cout << "Aprobado\\n"; } else { cout << "Reprobado\\n"; } cout << "Como le fue: " << comolefue << endl; system("pause"); system("cls"); if (promediocalificaciones < 70) { cout << "el estudiante esta aplazado con un promedio de: " << promediocalificaciones << " desea agregar un porcentaje de curva?(Si/No): "; cin >> yes\_no; while (yes\_no != "Si" && yes\_no != "No" && yes\_no != "si" && yes\_no != "no") { system("cls"); cout << "parametro invalido, Digite Si o No: "; cin >> yes\_no; } if (yes\_no == "Si" || yes\_no == "si") { cout << "\\nDigite el porcentaje adicional deseado: "; cin >> porcentaje; if (p1->apruebaconcurva(porcentaje) == 1) { 

    notafinal = (promediocalificaciones + promediocalificaciones * porcentaje / 100);

    cout << "El estudiante: " << nombre << " aprueba con una curva del: " << porcentaje << "% con nota final de: " << notafinal << endl;

     } else { 

    notafinal = (promediocalificaciones + promediocalificaciones * porcentaje / 100);

    cout << "El estudiante: " << nombre << " reprueba con una curva del: " << porcentaje << "% con nota final de: " << notafinal << endl;

     } } else if (yes\_no == "No" || yes\_no == "no") { system("cls"); cout << "La nota de " << nombre << " se mantendra con un promedio de " << promediocalificaciones << " con una condicion de Reprobado"<< endl; } } return 0; } 
    submitted by /u/Sehilion
    [link] [comments]

    Is it safe to trust the Host header sent in a request (I think not but need to know why)

    Posted: 14 Mar 2020 01:31 AM PDT

    I found something that seems odd in a product I use at work built by a vendor. To me it doesn't look right. I'm trying to figure out why it's insecure.

    Lets say I have a website, and that website outputs a form. i.e.

    <form action="https://example.com/submit-url"> ... </form> 

    The issue I've found is that the form's action is using the requests Host header as the base domain. If I make a request with the Host set to malicious-website.com, then the webpage will come back as ...

    <form action="https://malicious-website.com/submit-url"> ... </form> 

    I think that looks really bad. The reason why is because it's letting the request decide where the websiite will send data to, and that extends to being able to send data outside of the vendor's service. However I cannot think of an example of how one would exploit this.

    One example I had is that a proxy could set the Host, and then alter where it comes back. But a proxy could re-write the response anyway. So that's not really an exploit.

    The vendor's communication is typical of working with an enterprise level vendor (i.e. really bad and very non-technical). I want to come up with a test to show why it's insecure, and use that as a means to get it changed.

    To summarise ...

    • Is this an issue?
    • What is an example vulnerability that abuses this?
    submitted by /u/jl2352
    [link] [comments]

    IDE for non-typers

    Posted: 13 Mar 2020 11:44 PM PDT

    Hi everyone. I used to code but developed carpal tunnel so I started doing other things. However, I enjoy coding and do it as a hobby. Right now I VNC into a Windows computer running IntelliJ on my iPad which I operate with a stylus.. It works but I'm wondering if something better exists.

    Does such an IDE exist that generates code for you? I mean, say, for-loops, if-then constructs, etc. - the basic elements of a language without having to type a million tabs, curly-braces,,etc. You could, say, drag and drop a for-loop and as you set it in place, a dialog pops up asking for particulars.

    I used to use C++ Builder and it involves rearranging components instead of typing so this may work but I think it's limited primarily to database stuff? I also looked at PWCT but couldn't get it to work but seems like it's in the same direction I'm going for albeit a bit higher-up. There's also that executable UML stuff, too.

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

    No comments:

    Post a Comment