Cum sa normalizezi o baza de date

Dupa aproape 4 ani revin asupra acestui subiect pentru ca e clar ridica probleme in randul incepatorilor ce au de a face cu bazele de date. Spun incepatori deoarece sincer, eu nu mai folosesc aceasta metoda de mormalizare lucrurile venind de la sine.

Un exemplu de normalizare il gasiti aici: exemplu normalizare baza de date abonati telefonici

Iata scenariul:

Sa se proiecteze o baza de date pentru o organizatie, avand in vedere urmatoarele constrangeri: – constrangerea de integritate a entitatii; – constrangerea de integritate referentiala; – baza de date contine cel putin 6 tabele; – baza de date contine cel putin un tabel referential (entitate referentiala transversala).

Normalizarea se va face pe baza primelor 3 forme normale. Dupa proiectare, trebuie realizata diagrama entitate-asociere utilizand aplicatia MySQL Workbench, precum si scriptul SQL care implementeaza baza de date.

Sa se implementeze o operatie de tip JOIN pe trei tabele, care sa utilizeze cel putin o functie de sumarizare si sa contina cel putin o filtrare. Sa se implememnteze o vizualizare avand la baza o operatie de tip JOIN (diferita de cea precizata la punctul anterior).

Cum gandim si ce facem de aici:
In primul rand trebuie sa plecam de la ideea centrala pentru care dorim normalizarea.

De exemplu pentru o ferma cu animale sa zicem ca vrem sa tinem minte ce vaccinari ii sunt facute unui animal dealungul vietii. Pentru asta in baza de date vom aveam nevoie de date de identificare pentru animal, date de identificare pentru vaccin, date de identificare pentru cel ce a facut vaccinul, nu?

Pasul 1

bazaAnimale(idAnimal, numeAnimal, varstaAnimal, tipAnimal, idMedicIngrijitor, numeMedicIngrijitor, telefonMedicIngrijitor, idVaccin, numeVaccin, dozaVaccin, tarifDoza)

Pasul 2

Aici incepe pur si simplu normalizarea.

Procesul de normalizare consta in “spargerea” acestei baza de date in tabele astfel incat informatia gazduita in sistem sa fie minimala. (De ce sa avem un spatiu ocupat de 2Mb cand putem avea 1.5Mb?, nu?)

  • De exemplu mai multe animale pot sa aiba acelasi ingrijitor: nu ar fi mai util ca ingrijitorul la care se face referire sa fie identificat printr-un numar? (nu vom mai avea ceva de genul: animal 1, 10 ani, porc cu ingrijitorul Popescu Ion 0700 000 000 ci vom sti ca ingrijitorul x (x – un numar) este popescu ion si astfel vom rezolva mult mai usor situatiile in care acesta sa zicem is modifica numarul de telefon.
  • Un alt exemplu similar cu cel de sus este faptul ca unui animal ii pot fi facute o serie de vaccinuri. Dintre acestea o parte ii sunt administrate si unui al animal.

Procesul de nomalizare presupune mai multe etape, etape ce face ca Bazei de date normalizate sa ii fie aplicate mai multi algorimti de “simplicare” numiti si FORME NORMALE (NORMAL FORMS).

Continue reading

How to create a vanilla bootable Hackintosh USB

First of all you should know that the latest version of MAC OS X can be ruined only on a Intel PC. There are some kernels that are modded to support AMD architecture but those are not officially supported and in conclusion there could be some bugs while you’re running the system.

Now lets focus our attention on the main idea: building a bootable vanilla usb for your hackintosh. The system that I will demo on is the latest mac os version available from Apple: 10.9 MavericksOS-X-Mavericks-logo

Creating the installer

  1. Prepare your USB as GUID partition map with a HFS+ partition.
  2. SS1_zpsb4475ce9
  3. Mount your Mavericks DMG (Right click on “Install OS X 10.9 Golden Master” then its in /Contents/Shared Support/InstallESD.dmg)
  4. Mount BaseSystem.dmg by typing the following in terminal: open /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg or if you want a simpler way just open the show hidden files app attached and click SHOW. Now you should see the BaseSystem.dmg inside InstallESD.dmg
  5. Restore “OS X Base System” to your USB
  6. SS3_zpsaa1f3901
  7. Navigate to /System/Installation your USB drive Delete the “Packages” link then copy the Packages folder from “OS X Install ESD” to this location.
  8. Use pacifist to extract mach_kernel from /OS X Install ESD/Packages/BaseSystemBinaries.pkg to the root of your USB drive. (Note: This is in the attachment).
  9. Copy essential kexts to /System/Library/Extensions on your USB stick.
  10. Install chameleon to the USB drive (I personally like Enoch – a version of chameleon: http://www.mediafire.com/?td37c3mixppbftx)
  11. SS4_zps58f52e7b
  12. SS5_zps01e0ed83
  13. Create the extra folder for the USB (copy your old one over – for those how have a pro book 4540s with a 3210i processor you could use the following one:  http://www.mediafire.com/?fqkho4t1lq7lm8l)
  14. Inside you extra folder copy the following extensions folder: http://www.mediafire.com/download/rgorvqb2swh9z6k/Extensions.zip (this will assure the correct boot of your mac installer)!
  15. Copy your folder of essential software & kexts to your USB stick.

 

After installing the system use the USB to boot into it and install the required Kexts (Kernel Extensions) and the Chameleon boot loader to be able to boot without USB later on.

Using this method i was able to make the the best vanilla install that could be. For sure this method is comparable with the result of Unibeast software, so please let me know how did this method worked for you or if it doesn’t work i’ll try to provide the correct answers to help you install the OS X on your particular hackinthos.

Get Romanian spell-checking in Mac OS X

A SIMPLE STEP-BY-STEP GUIDE

As you may know—all too well—Apple’s Mac OS X doesn’t offer native support for Romanian spell checking. Quite an embarrassment.

However, it is possible to install a Romanian spell-check dictionary (with diacritics and all)—in three fairly easy steps—available to all applications using system spell-checking services, like Mail, Pages, Keynote, Safari, iChat etc.1

Romanian Spellcheck in Apple Mac OS X / Corector ortografic pentru limba română în Apple Mac OS X, © Cristian -Kit- Paul, Bucharest, 2010.

Here is how to add system-wide Romanian spell-check dictionary to Mac OS X—a simple step-by-step guide. Continue reading