This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestAudioFileMain { | |
private static char sep; | |
private static String root = "/"; | |
private static char emulateWindows() { | |
System.setProperty("os.name", "Windows"); | |
System.setProperty("file.separator", "\\"); | |
return '\\'; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Adresa { | |
private String strada; | |
private String oras; | |
private String codPostal; | |
public Adresa(String strada, String oras, String codPostal) { | |
this.strada = strada; | |
this.oras = oras; | |
this.codPostal = codPostal; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mp3player; | |
public class Main { | |
public static void main(String[] args) { | |
// Testăm clasa AudioFile cu diferite căi de fișiere | |
AudioFile file1 = new AudioFile("C:\\Music\\Queen - Bohemian Rhapsody.mp3"); | |
System.out.println("Pathname: " + file1.getPathname()); | |
System.out.println("Filename: " + file1.getFilename()); | |
System.out.println("Author: " + file1.getAuthor()); | |
System.out.println("Title: " + file1.getTitle()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void parsePathname( String path ) { | |
this.pathname = "" | |
this.filename = "" | |
if(path == null || path.trim().isEmpty()) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to show map using OpenStreetMap with Leaflet | |
let map; | |
let marker; | |
function showMap(lat, lng, name) { | |
mapContainer.style.display = 'flex'; | |
// If the map doesn't exist yet, create it | |
if (!map) { | |
map = L.map('map').setView([lat, lng], 15); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let buttons = document.querySelectorAll('.view-map'); | |
for (let i = 0; i < buttons.length; i++) { | |
buttons[i].addEventListener('click', function() { | |
const card = this.closest('.place-card'); | |
const lat = card.dataset.lat; | |
const lng = card.dataset.lng; | |
const name = card.dataset.name; | |
if (lat && lng) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function displayPlaces(places) { | |
if (places.length === 0) { | |
resultsContainer.innerHTML = '<div class="loading">No places found. Try a different location or category.</div>'; | |
return; | |
} | |
resultsContainer.innerHTML = ""; // Clear previous results | |
for (let i = 0; i < places.length; ++i) { | |
const place = places[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let i = 0; i < places.length; ++i) { | |
const place = places[i]; | |
const address = place.location?.formatted_address || place.location?.address || 'Address not available'; | |
const categories = place.categories?.map(cat => cat.name).join(', ') || 'Category not available'; | |
const lat = place.geocodes?.main?.latitude; | |
const lng = place.geocodes?.main?.longitude; | |
output += ` | |
<div class="place-card" data-lat="${lat}" data-lng="${lng}" data-name="${place.name}"> | |
<div class="place-image"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cerere asincronă simplă | |
async function cautaProdus() { | |
// Arată că suntem în proces de încărcare | |
console.log('Se caută produsul...'); | |
try { | |
// Trimite cererea - nu blochează alte lucruri | |
const raspuns = await fetch('https://fakestoreapi.com/products/1'); | |
// Convertește răspunsul în JSON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function obtineDateUtilizator(idUtilizator) { | |
try { | |
// Folosim fetch pentru a face cererea | |
const raspuns = await fetch(`https://jsonplaceholder.typicode.com/users/${idUtilizator}`); | |
// Convertim răspunsul în format JSON | |
const date = await raspuns.json(); | |
// Afișăm datele utilizatorului | |
console.log('Date utilizator:', date); |