Giter Site home page Giter Site logo

lrazovic / advanced_programming Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6.36 MB

Project for the "Laboratory of Advanced Programming" course

Home Page: advanced-programming.vercel.app

License: MIT License

Dockerfile 2.01% Python 22.95% JavaScript 10.08% HTML 1.63% Vue 59.34% CSS 3.94% Shell 0.05%

advanced_programming's Introduction

Hi there, I'm Leonardo Razovic!

  • Software Engineer @ Polimec
  • Graduated from the first edition of the Polkadot Blockchain Academy @ Cambridge proof
  • I'm a MSc in Computer Science student at Università degli Studi di Roma "La Sapienza"
  • How to reach me:
    • Email: lrazovic[at]gmail.com
    • Telegram: [at]lrazovic
    • Twitter [at]lrazovic
    • Mastodon [at]lrazovic[at]mastodon.social
twitter badge linkedin badge instagram badge

Projects I liked most

🦄 = Blockchain related project 🦀 = Rust related project
  • 🦄🦀 SimplePool and a Substrate Node: This project aims to create a pallet to manage a liquidity pool. A user can stake a token (e.g. a DOT) and receive a liquid token (e.g. LDOT).
  • 🦄 NFT Swap: An NFT marketplace focused on Atomic Swaps. The contract is in Solidity and the Frontend is in Next.js. At the moment we are working on several EVM testnets and the frontend is hosted on Cloudflare Pages.
  • 🦀 OOTP (Open One-time Password): A library (available for both Typescript and Rust) plus a frontend (in Flutter) to generate HOTP (HMAC-based One-time Password) and TOTP (Time-based One-time Password).
  • 🦄 solana_pay: Next.js store that supports payments using the Solana blockchain. Exploiting Solana Pay!
  • 🦄🦀 buildspace_solana: Smart contract and related React frontend to save your favorite GIFs on Solana
  • 🦀 rusty-mqtt: A Rust bridge between the MQTT broker of The Things Network and ThingsBoard.
  • 🦀 rust_rsa: A simple RSA implementation in Rust developed to anchor theoretical concepts behind RSA.
  • 🦀 rust-hmac-sha: A pure Rust implementation of the Hash-based Message Authentication Code Algoritm for SHA-{1,2,3}. This project can be seen as an interface/wrapper for the RustCrypto crate, focusing on user/developer ease of use. Works in a #![no_std] environment.
  • 🦀 decode-git-object: A small Rust utility that decodes git objects, mainly useful for forensics, recovery, and CTF challenges 🚩.

Reading list

  • 📚 Engineering Management for the Rest of Us by Sarah Drasner
  • A Philosophy of Software Design by John Ousterhout
  • Cracking the Coding Interview, 6th Edition by Gayle Laakmann McDowell
  • Zero To Production In Rust by Luca Palmieri
  • Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin
  • The Pragmatic Programmer: Your Journey to Mastery, 20th Anniversary Edition by Dave Thomas and Andy Hunt
  • Cryptography and Network Security: Principles and Practice by William Stallings
  • Engineering Software As a Service: An Agile Approach Using Cloud Computing by Armando Fox and David A. Patterson

📚 = currently reading

Favourite quotes

Building software systems is a constant wrestling match between ideals, pragmatism, aesthetics, and time. Reality never quite matches the ideal. Nothing is ever perfect, but things can be good.

-> Rob Habermeier, Polkadot founder

Be curious, not judgmental

-> (Not) Walt Whitman


Curious about the origin of my surname? My grandfather was Croatian, from an island near Split (/ˈsplɪt/, as in the English word "split") 🇭🇷

advanced_programming's People

Contributors

a-i-18 avatar lrazovic avatar nojano avatar nurper avatar plamax1 avatar

Stargazers

 avatar

Watchers

 avatar

advanced_programming's Issues

Kick-start to the Scrum Dashboard

Call protected APIs

  • If we visit localhost:3000/auth/login the Google Sign-in page appears.
  • Then, in the front-end we have to obtain, and save a JWT token.
  • The token can be saved in cookie/local-storage, then we have to use this token frontend-side to perform authenticated HTTP methods as authentication header like:
headers:{
    "Authorization": "Bearer " + window.localStorage.getItem("jwt")
},
  • A simple HTML+JS front-end can be found here, we have to replicate this using Vue instead of HTML. You can test it visiting http://localhost:3000/auth/login that redirects to http://localhost:3000/token after the Google Login. In the console you can see the server responses.

Setup Git

Setup git for accessing also a private repo <--> ssh auth.

Endpoint for adding a RSS Feed to a certain user

curl -X 'PUT' \ 'http://localhost:5000/dummy/put-user-rss-feed' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "user_id": 1, "rssFeeds": [ { "url": "http://feeds.bbci.co.uk/news/world/rss.xml", "rank": 1 } ] }'

Give the user the possibility to enter a RSS url

TextBox which a user can fill with a url of a new Feed to relate to its profile.

Back-end endpoint:

curl --location --request PUT 'localhost:5000/api/users/1/rss-feeds' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbnRvbmlvLmlvbnRhLjE4QGdtYWlsLmNvbSIsImV4cCI6MTY0NTAzOTEyNX0.ISE4g1-Fx__w4gVfg_AezYQFbcOvzwvZJlLfheqxs7Y' \
--header 'Content-Type: application/json' \
--data-raw '{
  "user_id": 1,
  "rssFeeds": [
    {
      "url": "url1",
      "rank": 1
    },
    {
      "url": "url2",
      "rank": 2
    }
  ]
}'

Output

{
    "jsonrpc": "2.0",
    "result": "User with id 1 updated: new list of associated RSS feeds",
    "id": "e3969c35-dc5f-49bd-aad7-b270d63502ce"
}

Node Auth - Check Google Token

Expose a distinct endpoint receiving an access token as input and outputting a boolean value: true iff the access token received is complaint with Google standard and not currently expired.

Function Points

After the definition of the user stories/requirements, you need to estimate the complexity of the software development, time and effort to carry it out, by using Function Points and COCOMO II methods. The analysis should be presented through spreadsheets (see the material) and a booklet explaining and detailing your method. At the end of the academic year, it will be interesting to compare estimation with actual KLOCs of the projects.

Complete user info front-end

Attach to the following endpoint for retrieving all the user info giving as input the access token available at the moment of log-in.

Back-end endpoint

curl --location --request GET 'localhost:5000/api/users/3' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbnRvbmlvLmlvbnRhLjE4QGdtYWlsLmNvbSIsImV4cCI6MTY0NTAzOTEyNX0.ISE4g1-Fx__w4gVfg_AezYQFbcOvzwvZJlLfheqxs7Y'

Output

json
{
    "jsonrpc": "2.0",
    "result": {
        "name": "bla",
        "id": 2,
        "email": "[email protected]",
        "password": "blapass",
        "rssFeeds": [
            {
                "rank": 1,
                "id": 1,
                "url": "url1",
                "user_id": 2
            },
            {
                "rank": 2,
                "id": 2,
                "url": "url2",
                "user_id": 2
            }
        ]
    },
    "id": "6d83d8b7-757d-489d-bf31-649cceb86bbe"
}

Present Feed Information

Substitute mocked part of the dashboard with data coming from feed service. JSON structure as example:

"title": "Fuori valdostani dentro cosmopoliti",
      "link": "https://www.repubblica.it/design/2021/12/22/news/fuori_valdostani_dentro_cosmopoliti-331235990/?rss",
      "author": "[email protected] (Redazione Repubblica.it)",
      "time_published": "Wed, 22 Dec 2021 18:16:38 +0100",
      "tags": [
        "design"
      ],
      "authors": [
        "Redazione Repubblica.it"
      ],
      "summary": "<p><a href=\"https://www.repubblica.it/design/2021/12/22/news/fuori_valdostani_dentro_cosmopoliti-331235990/?rssimage\"> <img align=\"left\" hspace=\"10\" src=\"https://www.repstatic.it/content/nazionale/img/2021/12/22/184036876-c35df21f-01c3-46d1-b80f-40b5c3a49628.jpg\" width=\"140\" /></a>Les Niveaux, sette chalet incastonati negli scenari del Monte Bianco con esterni che rispettano materiali e stile dell\u2019architettura locale. Ma gli interni rivelano vocazione internazionale e spirito mondano</p>"

(html marckup will be removed, just ignore it)

Attach ML API

Button on each news card triggering the API for ML processing (summarizing the textual content given as input).

WIP signature of API:

  • Authenticated POST on /api/summary with a payload a JSON like:
{
  "body": "A very long text, mainly written in English"
}
  • NOT Authenticated POST, just for testing, on /dummy/summary with a payload a JSON like:
{
  "body": "A very long text, mainly written in English"
}
  • Playground to test the APIs: http://localhost:5000/api/docs and http://localhost:5000/dummy/docs (Available after docker compose up --build)

Switch RSS Feed

Select for giving the user the possibility to switch among its RSS Feeds

Back-end endpoint:

curl --location --request GET 'localhost:5000/api/news?feed_url=http://www.aljazeera.com/xml/rss/all.xml&limit=3' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbnRvbmlvLmlvbnRhLjE4QGdtYWlsLmNvbSIsImV4cCI6MTY0NTAzOTEyNX0.ISE4g1-Fx__w4gVfg_AezYQFbcOvzwvZJlLfheqxs7Y'

Output

{
    "jsonrpc": "2.0",
    "result": {
        "Blog title": "Al Jazeera – Breaking News, World News and Video from Al Jazeera",
        "Blog link": "https://www.aljazeera.com",
        "posts": [
            {
                "title": "‘Fortress’ Japan set to announce easing of strict border measures",
                "link": "https://www.aljazeera.com/economy/2022/2/17/fortress-japan-set-to-announce-easing-of-strict-border-measures"
            },
            {
                "title": "France, European allies announce military withdrawal from Mali",
                "link": "https://www.aljazeera.com/news/2022/2/17/france-allies-announce-military-withdrawal-from-mali"
            },
            {
                "title": "Bridgewater fight video: Outrage over US police action",
                "link": "https://www.aljazeera.com/news/2022/2/17/bridgewater-fight-video-outrage-over-us-police-action"
            }
        ]
    },
    "id": "553131df-beac-43d2-a192-ca2c62480ccc"
}

Relation User Preferences

Relation for persisting user preferences about RSS to contact. Model:

  • id
  • name
  • url
  • priority [1,2,3]

Association with User

Attach delete user functionality

User profile

Button for triggering the API dedicated to the elimination of all the user data.

Backend endpoint

curl --location --request DELETE 'localhost:5000/api/users/4' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbnRvbmlvLmlvbnRhLjE4QGdtYWlsLmNvbSIsImV4cCI6MTY0NTAzOTEyNX0.ISE4g1-Fx__w4gVfg_AezYQFbcOvzwvZJlLfheqxs7Y'

Output

{
    "jsonrpc": "2.0",
    "result": "\nDeleted User with id: 4\n",
    "id": "024782bc-635b-4434-bc2b-98a91fb33480"
}

Report Definition

Document summing up all the project expereince:

  1. Intial Idea
  2. User Stories
  3. Estimation - COCOMO II + FP
  4. System Architecture
  5. Sprint analytics + planning
  6. Conclusion: repo + docker compose up

Model Definition

Structure the model of the persistence system: UML/Entity Relationship.

Have in mind that the physical storage will happen in a NoSQL system (MongoDB), so levels of aggregation should be specified.

Attach Fetcher API

WIP signature of API:

  • Authenticated POST on /api/getnews with a payload a JSON like:
{
  "url": "http://feeds.bbci.co.uk/news/world/rss.xml",
  "limit": 10
}
  • NOT Authenticated POST, just for testing, on /dummy/getnews with a payload a JSON like:
{
  "url": "http://feeds.bbci.co.uk/news/world/rss.xml",
  "limit": 10
}
  • Playground to test the APIs: http://localhost:5000/api/docs and http://localhost:5000/dummy/docs (Available after docker compose up --build)

Test Task

Precise and concise description :-)

Add a persistence layer

  • Setup a MongoDB database using Docker
  • So we can use mongoose or other libraries to access it via Python/Node.js

Display full text of an article

Given an url link to an article obtain the full text from

Back-end endpoint

curl --location --request GET 'localhost:5000/api/news/articles?article_url=https://www.aljazeera.com/news/2022/2/16/canada-police-to-anti-vaccine-truckers-leave-now-or-face-arrest' \
--header 'Authorization: Bearer **eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhbnRvbmlvLmlvbnRhLjE4QGdtYWlsLmNvbSIsImV4cCI6MTY0NTAzOTEyNX0.ISE4g1-Fx__w4gVfg_AezYQFbcOvzwvZJlLfheqxs7Y'**

Output

{
    "jsonrpc": "2.0",
    "result": "Police in the Canadian capital have warned truck drivers blockading Ottawa’s downtown core that they must leave or face arrest, as authorities strengthen efforts to disperse an anti-government protest that has paralysed the city for nearly three weeks.\n\n“You must leave the area now. Anyone blocking streets, or assisting others in the blocking [of] streets, are [sic] committing a criminal offence and you may be arrested,” a leaflet handed out by police on Wednesday morning reads.\n\n“You must immediately cease further unlawful activity or you will face charges.”\n\nPolice also began ticketing some of the hundreds of vehicles blocking the downtown core.\n\nThe warnings come after Canadian Prime Minister Justin Trudeau invoked a never-before-used emergency measure on Monday to give his federal government more power to assist law enforcement agencies in dispersing the protesters.\n\nA large group of Canadian truckers and their supporters descended on Ottawa late last month to protest against a mandatory coronavirus vaccination requirement for travel across the US-Canada land border.\n\nSince then, participants in the so-called “Freedom Convoy” – organised by far-right activists – have maintained what residents describe as an “occupation” of Ottawa’s downtown core, pledging to continue their protest until all COVID-19 curbs are lifted in Canada.\n\nOttawa residents have decried the demonstrators for parking their vehicles on residential streets, harassing and threatening people, honking their horns and setting off fireworks at all hours of the night.\n\nOn Tuesday, Ottawa Police Service Chief Peter Sloly – who was widely criticised for the force’s handling of the protest – announced his resignation.\n\nThe leaflet handed out on Wednesday references the Emergencies Act that Trudeau invoked this week, saying it allows police to seize vehicles that are part of the demonstration. Anyone who travels to Ottawa to join the protest is breaking the law, it also states.\n\n“Politicians don’t decide when and how the police should act but we have given them a lot more tools and we hope they will be able to use them … to ensure this barricade ends,” Trudeau told reporters on Wednesday.\n\nA day earlier, the commissioner of Canada’s federal Royal Canadian Mounted Police (RCMP), Brenda Lucki, said she had spoken with leaders of the Ottawa and Ontario provincial police services to discuss the way forward.\n\n“Our teams are committed and look forward to working together,” Lucki tweeted late on Tuesday.\n\nOttawa police hand out notices to protesters ordering them to leave immediately or face arrest. Say those who refuse face fines and/or jail time. pic.twitter.com/O2VT1f16Y8 — CBC News Alerts (@CBCAlerts) February 16, 2022\n\nSeparately, the RCMP announced earlier this week that a total of 13 people had been arrested after a search uncovered multiple firearms, body armour, a machete, ammunition and high-capacity magazines at a border blockade in the western province of Alberta.\n\n“Information was received that this group had access to a cache of firearms with a large quantity of ammunition. The group was said to have a willingness to use force against the police if any attempts were made to disrupt the blockade,” the RCMP said on Monday.\n\nA day later, the RCMP also said four people involved in the blockade at Coutts – a crossing that links Alberta to the US state of Montana – had been charged with conspiracy to commit murder.\n\nThe Coutts blockade ended on Tuesday, and a similar one in the Manitoba town of Emerson was cleared around midday on Wednesday, the RCMP said.\n\nMeanwhile, back in Ottawa, hundreds of protesters remain camped out on Parliament Hill.\n\n“If it means that I need to go to prison, if I need to be fined in order to allow freedom to be restored in this country — millions of people have given far more for their freedom,” David Paisley, who travelled to Ottawa with a friend who is a truck driver, told The Associated Press.",
    "id": "c9586ac8-af01-4652-a480-22dcb72b1bf1"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.