├── .gitignore ├── LICENCE ├── README.md ├── computer-organisation ├── assembly.md └── not-assembly.md ├── docs ├── documentup.js ├── documentup.min.js ├── favicon.ico ├── index.html └── robots.txt ├── git └── README.md ├── object-oriented-programming ├── BasicsToJava.md ├── Java.md └── README.md ├── reasoning-and-logic └── README.md └── web-and-database-technology ├── Demo1.md ├── README.md ├── database.md └── web.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,linux,windows 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### OSX ### 20 | # General 21 | .DS_Store 22 | .AppleDouble 23 | .LSOverride 24 | 25 | # Icon must end with two \r 26 | Icon 27 | 28 | # Thumbnails 29 | ._* 30 | 31 | # Files that might appear in the root of a volume 32 | .DocumentRevisions-V100 33 | .fseventsd 34 | .Spotlight-V100 35 | .TemporaryItems 36 | .Trashes 37 | .VolumeIcon.icns 38 | .com.apple.timemachine.donotpresent 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | ### Windows ### 48 | # Windows thumbnail cache files 49 | Thumbs.db 50 | ehthumbs.db 51 | ehthumbs_vista.db 52 | 53 | # Dump file 54 | *.stackdump 55 | 56 | # Folder config file 57 | [Dd]esktop.ini 58 | 59 | # Recycle Bin used on file shares 60 | $RECYCLE.BIN/ 61 | 62 | # Windows Installer files 63 | *.cab 64 | *.msi 65 | *.msix 66 | *.msm 67 | *.msp 68 | 69 | # Windows shortcuts 70 | *.lnk 71 | 72 | 73 | # End of https://www.gitignore.io/api/osx,linux,windows -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | Attribution-NonCommercial-ShareAlike 3.0 Unported 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR 10 | DAMAGES RESULTING FROM ITS USE. 11 | 12 | License 13 | 14 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE 15 | COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY 16 | COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS 17 | AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. 18 | 19 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE 20 | TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY 21 | BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS 22 | CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND 23 | CONDITIONS. 24 | 25 | 1. Definitions 26 | 27 | a. "Adaptation" means a work based upon the Work, or upon the Work and 28 | other pre-existing works, such as a translation, adaptation, 29 | derivative work, arrangement of music or other alterations of a 30 | literary or artistic work, or phonogram or performance and includes 31 | cinematographic adaptations or any other form in which the Work may be 32 | recast, transformed, or adapted including in any form recognizably 33 | derived from the original, except that a work that constitutes a 34 | Collection will not be considered an Adaptation for the purpose of 35 | this License. For the avoidance of doubt, where the Work is a musical 36 | work, performance or phonogram, the synchronization of the Work in 37 | timed-relation with a moving image ("synching") will be considered an 38 | Adaptation for the purpose of this License. 39 | b. "Collection" means a collection of literary or artistic works, such as 40 | encyclopedias and anthologies, or performances, phonograms or 41 | broadcasts, or other works or subject matter other than works listed 42 | in Section 1(g) below, which, by reason of the selection and 43 | arrangement of their contents, constitute intellectual creations, in 44 | which the Work is included in its entirety in unmodified form along 45 | with one or more other contributions, each constituting separate and 46 | independent works in themselves, which together are assembled into a 47 | collective whole. A work that constitutes a Collection will not be 48 | considered an Adaptation (as defined above) for the purposes of this 49 | License. 50 | c. "Distribute" means to make available to the public the original and 51 | copies of the Work or Adaptation, as appropriate, through sale or 52 | other transfer of ownership. 53 | d. "License Elements" means the following high-level license attributes 54 | as selected by Licensor and indicated in the title of this License: 55 | Attribution, Noncommercial, ShareAlike. 56 | e. "Licensor" means the individual, individuals, entity or entities that 57 | offer(s) the Work under the terms of this License. 58 | f. "Original Author" means, in the case of a literary or artistic work, 59 | the individual, individuals, entity or entities who created the Work 60 | or if no individual or entity can be identified, the publisher; and in 61 | addition (i) in the case of a performance the actors, singers, 62 | musicians, dancers, and other persons who act, sing, deliver, declaim, 63 | play in, interpret or otherwise perform literary or artistic works or 64 | expressions of folklore; (ii) in the case of a phonogram the producer 65 | being the person or legal entity who first fixes the sounds of a 66 | performance or other sounds; and, (iii) in the case of broadcasts, the 67 | organization that transmits the broadcast. 68 | g. "Work" means the literary and/or artistic work offered under the terms 69 | of this License including without limitation any production in the 70 | literary, scientific and artistic domain, whatever may be the mode or 71 | form of its expression including digital form, such as a book, 72 | pamphlet and other writing; a lecture, address, sermon or other work 73 | of the same nature; a dramatic or dramatico-musical work; a 74 | choreographic work or entertainment in dumb show; a musical 75 | composition with or without words; a cinematographic work to which are 76 | assimilated works expressed by a process analogous to cinematography; 77 | a work of drawing, painting, architecture, sculpture, engraving or 78 | lithography; a photographic work to which are assimilated works 79 | expressed by a process analogous to photography; a work of applied 80 | art; an illustration, map, plan, sketch or three-dimensional work 81 | relative to geography, topography, architecture or science; a 82 | performance; a broadcast; a phonogram; a compilation of data to the 83 | extent it is protected as a copyrightable work; or a work performed by 84 | a variety or circus performer to the extent it is not otherwise 85 | considered a literary or artistic work. 86 | h. "You" means an individual or entity exercising rights under this 87 | License who has not previously violated the terms of this License with 88 | respect to the Work, or who has received express permission from the 89 | Licensor to exercise rights under this License despite a previous 90 | violation. 91 | i. "Publicly Perform" means to perform public recitations of the Work and 92 | to communicate to the public those public recitations, by any means or 93 | process, including by wire or wireless means or public digital 94 | performances; to make available to the public Works in such a way that 95 | members of the public may access these Works from a place and at a 96 | place individually chosen by them; to perform the Work to the public 97 | by any means or process and the communication to the public of the 98 | performances of the Work, including by public digital performance; to 99 | broadcast and rebroadcast the Work by any means including signs, 100 | sounds or images. 101 | j. "Reproduce" means to make copies of the Work by any means including 102 | without limitation by sound or visual recordings and the right of 103 | fixation and reproducing fixations of the Work, including storage of a 104 | protected performance or phonogram in digital form or other electronic 105 | medium. 106 | 107 | 2. Fair Dealing Rights. Nothing in this License is intended to reduce, 108 | limit, or restrict any uses free from copyright or rights arising from 109 | limitations or exceptions that are provided for in connection with the 110 | copyright protection under copyright law or other applicable laws. 111 | 112 | 3. License Grant. Subject to the terms and conditions of this License, 113 | Licensor hereby grants You a worldwide, royalty-free, non-exclusive, 114 | perpetual (for the duration of the applicable copyright) license to 115 | exercise the rights in the Work as stated below: 116 | 117 | a. to Reproduce the Work, to incorporate the Work into one or more 118 | Collections, and to Reproduce the Work as incorporated in the 119 | Collections; 120 | b. to create and Reproduce Adaptations provided that any such Adaptation, 121 | including any translation in any medium, takes reasonable steps to 122 | clearly label, demarcate or otherwise identify that changes were made 123 | to the original Work. For example, a translation could be marked "The 124 | original work was translated from English to Spanish," or a 125 | modification could indicate "The original work has been modified."; 126 | c. to Distribute and Publicly Perform the Work including as incorporated 127 | in Collections; and, 128 | d. to Distribute and Publicly Perform Adaptations. 129 | 130 | The above rights may be exercised in all media and formats whether now 131 | known or hereafter devised. The above rights include the right to make 132 | such modifications as are technically necessary to exercise the rights in 133 | other media and formats. Subject to Section 8(f), all rights not expressly 134 | granted by Licensor are hereby reserved, including but not limited to the 135 | rights described in Section 4(e). 136 | 137 | 4. Restrictions. The license granted in Section 3 above is expressly made 138 | subject to and limited by the following restrictions: 139 | 140 | a. You may Distribute or Publicly Perform the Work only under the terms 141 | of this License. You must include a copy of, or the Uniform Resource 142 | Identifier (URI) for, this License with every copy of the Work You 143 | Distribute or Publicly Perform. You may not offer or impose any terms 144 | on the Work that restrict the terms of this License or the ability of 145 | the recipient of the Work to exercise the rights granted to that 146 | recipient under the terms of the License. You may not sublicense the 147 | Work. You must keep intact all notices that refer to this License and 148 | to the disclaimer of warranties with every copy of the Work You 149 | Distribute or Publicly Perform. When You Distribute or Publicly 150 | Perform the Work, You may not impose any effective technological 151 | measures on the Work that restrict the ability of a recipient of the 152 | Work from You to exercise the rights granted to that recipient under 153 | the terms of the License. This Section 4(a) applies to the Work as 154 | incorporated in a Collection, but this does not require the Collection 155 | apart from the Work itself to be made subject to the terms of this 156 | License. If You create a Collection, upon notice from any Licensor You 157 | must, to the extent practicable, remove from the Collection any credit 158 | as required by Section 4(d), as requested. If You create an 159 | Adaptation, upon notice from any Licensor You must, to the extent 160 | practicable, remove from the Adaptation any credit as required by 161 | Section 4(d), as requested. 162 | b. You may Distribute or Publicly Perform an Adaptation only under: (i) 163 | the terms of this License; (ii) a later version of this License with 164 | the same License Elements as this License; (iii) a Creative Commons 165 | jurisdiction license (either this or a later license version) that 166 | contains the same License Elements as this License (e.g., 167 | Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License"). 168 | You must include a copy of, or the URI, for Applicable License with 169 | every copy of each Adaptation You Distribute or Publicly Perform. You 170 | may not offer or impose any terms on the Adaptation that restrict the 171 | terms of the Applicable License or the ability of the recipient of the 172 | Adaptation to exercise the rights granted to that recipient under the 173 | terms of the Applicable License. You must keep intact all notices that 174 | refer to the Applicable License and to the disclaimer of warranties 175 | with every copy of the Work as included in the Adaptation You 176 | Distribute or Publicly Perform. When You Distribute or Publicly 177 | Perform the Adaptation, You may not impose any effective technological 178 | measures on the Adaptation that restrict the ability of a recipient of 179 | the Adaptation from You to exercise the rights granted to that 180 | recipient under the terms of the Applicable License. This Section 4(b) 181 | applies to the Adaptation as incorporated in a Collection, but this 182 | does not require the Collection apart from the Adaptation itself to be 183 | made subject to the terms of the Applicable License. 184 | c. You may not exercise any of the rights granted to You in Section 3 185 | above in any manner that is primarily intended for or directed toward 186 | commercial advantage or private monetary compensation. The exchange of 187 | the Work for other copyrighted works by means of digital file-sharing 188 | or otherwise shall not be considered to be intended for or directed 189 | toward commercial advantage or private monetary compensation, provided 190 | there is no payment of any monetary compensation in con-nection with 191 | the exchange of copyrighted works. 192 | d. If You Distribute, or Publicly Perform the Work or any Adaptations or 193 | Collections, You must, unless a request has been made pursuant to 194 | Section 4(a), keep intact all copyright notices for the Work and 195 | provide, reasonable to the medium or means You are utilizing: (i) the 196 | name of the Original Author (or pseudonym, if applicable) if supplied, 197 | and/or if the Original Author and/or Licensor designate another party 198 | or parties (e.g., a sponsor institute, publishing entity, journal) for 199 | attribution ("Attribution Parties") in Licensor's copyright notice, 200 | terms of service or by other reasonable means, the name of such party 201 | or parties; (ii) the title of the Work if supplied; (iii) to the 202 | extent reasonably practicable, the URI, if any, that Licensor 203 | specifies to be associated with the Work, unless such URI does not 204 | refer to the copyright notice or licensing information for the Work; 205 | and, (iv) consistent with Section 3(b), in the case of an Adaptation, 206 | a credit identifying the use of the Work in the Adaptation (e.g., 207 | "French translation of the Work by Original Author," or "Screenplay 208 | based on original Work by Original Author"). The credit required by 209 | this Section 4(d) may be implemented in any reasonable manner; 210 | provided, however, that in the case of a Adaptation or Collection, at 211 | a minimum such credit will appear, if a credit for all contributing 212 | authors of the Adaptation or Collection appears, then as part of these 213 | credits and in a manner at least as prominent as the credits for the 214 | other contributing authors. For the avoidance of doubt, You may only 215 | use the credit required by this Section for the purpose of attribution 216 | in the manner set out above and, by exercising Your rights under this 217 | License, You may not implicitly or explicitly assert or imply any 218 | connection with, sponsorship or endorsement by the Original Author, 219 | Licensor and/or Attribution Parties, as appropriate, of You or Your 220 | use of the Work, without the separate, express prior written 221 | permission of the Original Author, Licensor and/or Attribution 222 | Parties. 223 | e. For the avoidance of doubt: 224 | 225 | i. Non-waivable Compulsory License Schemes. In those jurisdictions in 226 | which the right to collect royalties through any statutory or 227 | compulsory licensing scheme cannot be waived, the Licensor 228 | reserves the exclusive right to collect such royalties for any 229 | exercise by You of the rights granted under this License; 230 | ii. Waivable Compulsory License Schemes. In those jurisdictions in 231 | which the right to collect royalties through any statutory or 232 | compulsory licensing scheme can be waived, the Licensor reserves 233 | the exclusive right to collect such royalties for any exercise by 234 | You of the rights granted under this License if Your exercise of 235 | such rights is for a purpose or use which is otherwise than 236 | noncommercial as permitted under Section 4(c) and otherwise waives 237 | the right to collect royalties through any statutory or compulsory 238 | licensing scheme; and, 239 | iii. Voluntary License Schemes. The Licensor reserves the right to 240 | collect royalties, whether individually or, in the event that the 241 | Licensor is a member of a collecting society that administers 242 | voluntary licensing schemes, via that society, from any exercise 243 | by You of the rights granted under this License that is for a 244 | purpose or use which is otherwise than noncommercial as permitted 245 | under Section 4(c). 246 | f. Except as otherwise agreed in writing by the Licensor or as may be 247 | otherwise permitted by applicable law, if You Reproduce, Distribute or 248 | Publicly Perform the Work either by itself or as part of any 249 | Adaptations or Collections, You must not distort, mutilate, modify or 250 | take other derogatory action in relation to the Work which would be 251 | prejudicial to the Original Author's honor or reputation. Licensor 252 | agrees that in those jurisdictions (e.g. Japan), in which any exercise 253 | of the right granted in Section 3(b) of this License (the right to 254 | make Adaptations) would be deemed to be a distortion, mutilation, 255 | modification or other derogatory action prejudicial to the Original 256 | Author's honor and reputation, the Licensor will waive or not assert, 257 | as appropriate, this Section, to the fullest extent permitted by the 258 | applicable national law, to enable You to reasonably exercise Your 259 | right under Section 3(b) of this License (right to make Adaptations) 260 | but not otherwise. 261 | 262 | 5. Representations, Warranties and Disclaimer 263 | 264 | UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE 265 | FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS 266 | AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE 267 | WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT 268 | LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 269 | PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, 270 | ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT 271 | DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED 272 | WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU. 273 | 274 | 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE 275 | LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR 276 | ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES 277 | ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS 278 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 279 | 280 | 7. Termination 281 | 282 | a. This License and the rights granted hereunder will terminate 283 | automatically upon any breach by You of the terms of this License. 284 | Individuals or entities who have received Adaptations or Collections 285 | from You under this License, however, will not have their licenses 286 | terminated provided such individuals or entities remain in full 287 | compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will 288 | survive any termination of this License. 289 | b. Subject to the above terms and conditions, the license granted here is 290 | perpetual (for the duration of the applicable copyright in the Work). 291 | Notwithstanding the above, Licensor reserves the right to release the 292 | Work under different license terms or to stop distributing the Work at 293 | any time; provided, however that any such election will not serve to 294 | withdraw this License (or any other license that has been, or is 295 | required to be, granted under the terms of this License), and this 296 | License will continue in full force and effect unless terminated as 297 | stated above. 298 | 299 | 8. Miscellaneous 300 | 301 | a. Each time You Distribute or Publicly Perform the Work or a Collection, 302 | the Licensor offers to the recipient a license to the Work on the same 303 | terms and conditions as the license granted to You under this License. 304 | b. Each time You Distribute or Publicly Perform an Adaptation, Licensor 305 | offers to the recipient a license to the original Work on the same 306 | terms and conditions as the license granted to You under this License. 307 | c. If any provision of this License is invalid or unenforceable under 308 | applicable law, it shall not affect the validity or enforceability of 309 | the remainder of the terms of this License, and without further action 310 | by the parties to this agreement, such provision shall be reformed to 311 | the minimum extent necessary to make such provision valid and 312 | enforceable. 313 | d. No term or provision of this License shall be deemed waived and no 314 | breach consented to unless such waiver or consent shall be in writing 315 | and signed by the party to be charged with such waiver or consent. 316 | e. This License constitutes the entire agreement between the parties with 317 | respect to the Work licensed here. There are no understandings, 318 | agreements or representations with respect to the Work not specified 319 | here. Licensor shall not be bound by any additional provisions that 320 | may appear in any communication from You. This License may not be 321 | modified without the mutual written agreement of the Licensor and You. 322 | f. The rights granted under, and the subject matter referenced, in this 323 | License were drafted utilizing the terminology of the Berne Convention 324 | for the Protection of Literary and Artistic Works (as amended on 325 | September 28, 1979), the Rome Convention of 1961, the WIPO Copyright 326 | Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 327 | and the Universal Copyright Convention (as revised on July 24, 1971). 328 | These rights and subject matter take effect in the relevant 329 | jurisdiction in which the License terms are sought to be enforced 330 | according to the corresponding provisions of the implementation of 331 | those treaty provisions in the applicable national law. If the 332 | standard suite of rights granted under applicable copyright law 333 | includes additional rights not granted under this License, such 334 | additional rights are deemed to be included in the License; this 335 | License is not intended to restrict the license of any rights under 336 | applicable law. 337 | 338 | 339 | Creative Commons Notice 340 | 341 | Creative Commons is not a party to this License, and makes no warranty 342 | whatsoever in connection with the Work. Creative Commons will not be 343 | liable to You or any party on any legal theory for any damages 344 | whatsoever, including without limitation any general, special, 345 | incidental or consequential damages arising in connection to this 346 | license. Notwithstanding the foregoing two (2) sentences, if Creative 347 | Commons has expressly identified itself as the Licensor hereunder, it 348 | shall have all rights and obligations of Licensor. 349 | 350 | Except for the limited purpose of indicating to the public that the 351 | Work is licensed under the CCPL, Creative Commons does not authorize 352 | the use by either party of the trademark "Creative Commons" or any 353 | related trademark or logo of Creative Commons without the prior 354 | written consent of Creative Commons. Any permitted use will be in 355 | compliance with Creative Commons' then-current trademark usage 356 | guidelines, as may be published on its website or otherwise made 357 | available upon request from time to time. For the avoidance of doubt, 358 | this trademark restriction does not form part of this License. 359 | 360 | Creative Commons may be contacted at https://creativecommons.org/. 361 | 362 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 3 | > This repo is pretty outdated, for up to date content go to [CSHub](https://cshub.nl/) 4 | 5 | FAQ on everything from CSE delft year 1 6 | 7 | ## Courses 8 | 9 | ### Term 1 10 | 11 | - [Assembly](computer-organisation/assembly.md) 12 | - [Computer Organisation](computer-organisation/not-assembly.md) 13 | - [Object Oriented Programming](object-oriented-programming/BasicsToJava.md) 14 | - [Reasoning and Logic](reasoning-and-logic/README.md) 15 | 16 | ### Term 2 17 | 18 | - [Web & Database Technology](web-and-database-technology/README.md) 19 | 20 | ## Other summaries 21 | 22 | Other summaries created by students: 23 | 24 | - [atlasdev/TUD-CSE-summaries](https://github.com/AtlasDev/TUD-CSE-summaries) 25 | 26 | [![License](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/) 27 | 28 | FAQ by [https://csedelft.github.io/FAQ/](https://csedelft.github.io/FAQ/) is licensed 29 | under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/). 30 | 31 | Based on a work at [https://github.com/CSEdelft/FAQ](https://csedelft.github.io/FAQ/). 32 | -------------------------------------------------------------------------------- /computer-organisation/assembly.md: -------------------------------------------------------------------------------- 1 | # Assembly 2 | FAQ For Computer Organisation's Assembly 3 | ## Table of contents 4 | 1. [Registers](#registers) 5 | 1. [Table](#registers-table) 6 | 2. [Layout](#register-memory-layout) 7 | 2. [Opcode Table](#opcode-table) 8 | 3. [Stackframes](#stackframe) 9 | 4. [Addressing Modes](#addressing-modes) 10 | 5. [Assembler Directives](#assembler-directives) 11 | 6. [sections](#sections) 12 | 7. [X86 Calling Convention](#x86-calling-convention) 13 | 8. [Handy Links](#handy-links) 14 | 9. [GDB](#gdb) 15 | 10. [command line arguments](#command-line-arguments) 16 | 17 | ## Registers 18 | 19 | ### Registers Table 20 | |64-bit register | Lower 32 bits | Lower 16 bits | Lower 8 bits | 21 | | -------------- | ------------- | ------------- | ------------- | 22 | |rax | eax | ax | al | 23 | |rbx | ebx | bx | bl | 24 | |rcx | ecx | cx | cl | 25 | |rdx | edx | dx | dl | 26 | |rsi | esi | si | sil | 27 | |rdi | edi | di | dil | 28 | |rbp | ebp | bp | bpl | 29 | |rsp | esp | sp | spl | 30 | |r8 | r8d | r8w | r8b | 31 | |r9 | r9d | r9w | r9b | 32 | |r10 | r10d | r10w | r10b | 33 | |r11 | r11d | r11w | r11b | 34 | |r12 | r12d | r12w | r12b | 35 | |r13 | r13d | r13w | r13b | 36 | |r14 | r14d | r14w | r14b | 37 | |r15 | r15d | r15w | r15b | 38 | 39 | Other important registers: 40 | RIP = instruction pointer, points to the next instruction to be executed. changing this register is the same as a jumps 41 | RFLAGS = register that stores information about the last calculation (flags) to use for conditional jumps 42 | 43 | [Source/More Info](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/x64-architecture) 44 | 45 | 46 | ### Register Memory Layout 47 | Registers work like this, meaning every row in the above table is actually the same register but parts of it as shown below: 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
%ah
8 bits
%al
8 bits
%ax
16 bits
%eax
32 bits
%rax
64 bits
73 | 74 | 75 | 76 | ## Opcode Table 77 | | opcode | operands | function | description | 78 | | --- | --- | --- | --- | 79 | | mov | src,dst | dst = src | copy | 80 | | push | dst |(%rsp) = dst, %rsp -= 8 | pushes a value onto the stack | 81 | | pop | src | %rsp += 8,src=(%rsp) | pops a value off the stack | 82 | | xchg | A,B | A,B = B,A | switches the contents of A and B | 83 | | --- | --- | --- | --- | 84 | | addq | src,dst | dst = dst + src | adds src to dst | 85 | | subq | src,dst | dst = dst - src | subtracts src from dst | 86 | | inc | dst | dst = dst + 1 | adds 1 to dst | 87 | | dec | dst | dst = dst - 1 | subtracts 1 from dst | 88 | | mulq | src | rdx:rax = rax * src | multiplies rax by src (UNSIGNED) | 89 | | imulq | src | rdx:rax = rax * src | multiplies rax by src (SIGNED) | 90 | | divq | src | rdx:rax = rax / src | divides rax by src (SIGNED) | 91 | | idivq | src | rdx:rax = rax / src | divides rax by src (SIGNED) | 92 | | --- | --- | --- | --- | 93 | | jmp | label | | jumps to label (unconditional) | 94 | | je | label | | jumps to label (if equal) | 95 | | jne | label | | jumps to label (if not equal) | 96 | | jg| label | | jumps to label (if greater than) | 97 | | jl | label | | jumps to label (if less than) | 98 | | jle | label | | jumps to label (if less than or equal) | 99 | | jge | label | | jumps to label (if greater than or equal) | 100 | | call | label | push , jmp label | calls a function | 101 | | ret | | jmp (%rsp) | returns to caller | 102 | | loop | label | dec %rcx, jnz label | 103 | | --- | --- | --- | --- | 104 | | cmp | A,B | A - B (answer not stored but flags set) | compares 2 numbers. jump instruction follows | 105 | | xorq | src,dst | src = src xor dst | bitwise xor | 106 | | orq | src,dst | src = src and dst | bitwise and | 107 | | andq | src,dst | src = src or dst | bitwise and | 108 | | shlq | A,dst | src = src << A | shift left | 109 | | shrq | A,dst | src = src >> A | shift right | 110 | | not | dst | dst = 1111111- dst | bitwise inversion of dst | 111 | | neg | dst | dst = 0 - dst | 2's complement, result of not and add 1 | 112 | | leaq | A, dst | dst = &A | load effective adress (& means adress of) | 113 | | int | int_no | | software interrupt (see linux system calls above, used together with int 0x80) | 114 | 115 | ## Stackframe 116 | Generally, to initialize a stackframe use: 117 | ```assembly 118 | push %rbx #save necessary registers 119 | push %r12 120 | push %r13 121 | push %r14 122 | push %r15 123 | 124 | push %rbp #generate stackframe 125 | movq %rsp, %rbp 126 | ``` 127 | 128 | And to destroy it again use: 129 | ```assembly 130 | movq %rbp, %rsp #restore last stackframe 131 | pop %rbp 132 | 133 | pop %r15 #restore necessary registers 134 | pop %r14 135 | pop %r13 136 | pop %r12 137 | pop %rbx 138 | 139 | ret 140 | 141 | ``` 142 | 143 | ## Addressing Modes 144 | |example | name | description 145 | | --- | --- | --- | 146 | |movq $label,%rax | immediate (pointer) | loads the location of the label into rax | 147 | |movq label,%rax | immediate | loads the quadword at the location of the label into rax | 148 | |movq (%rbx),%rax | indirect | loads the quadword at the location pointed to by rbx into rax | 149 | |movq 8(%rbx),%rax | indirect offset (positive) | loads the quadword 8 after the location pointed to by rbx into rax | 150 | |movq -8(%rbx),%rax | indirect offset (negative) | loads the quadword 8 before the location pointed to by rbx into rax | 151 | |movq (%rbx,%rcx),%rax | indirect variable offset | loads the quadword at %rcx after the location pointed to by rbx into rax | 152 | |movq (%rbx,%rcx,8),%rax | indirect variable scaled offset (negative) | loads the quadword at %rcx*8 after the location pointed to by rbx into rax | 153 | |movq 8(%rbx,%rcx,8),%rax | indirect variable scaled offset (negative) +constant | loads the quadword at 8 after %rcx*8 after the location pointed to by rbx into rax | 154 | 155 | ## Assembler Directives 156 | 157 | Assembler directives are notes for the assembler which tell it how to do the compiling. 158 | 159 | | directive | explaination | 160 | | --------- | ------------ | 161 | | .quad | reserves space for a 64 bit number to be stored | 162 | | .long | reserves space for a 32 bit number to be stored | 163 | | .word | reserves space for a 16 bit number to be stored | 164 | | .byte | reserves space for a 8 bit number to be stored | 165 | | .asciz | reserves space for a string of text to be stored, automatically terminated by a 0 (NULL ) | 166 | | .ascii | reserves space for a string of text to be stored, *not* automatically terminated by a 0 (NULL ) | 167 | | .skip n | skips n bytes. useful for defining arrays of data. This should normally only be used in the .bss [section](#bss) | 168 | 169 | ## Sections 170 | 171 | The 4 sections of an assembly program are 172 | * [.text](#text) 173 | * [.data](#data) 174 | * [.bss](#bss) 175 | * [.rodata](#rodata) 176 | 177 | using linker scripts (google if you want to know more) more sections can be added. this is done in the gamelib for assignment 7 178 | 179 | note that any part of assembly can be in any section. sections are *just* for optimalization. This means you can put data in text, and text in bss. the only 'restrictive' section is rodata because it can only store read only data. 180 | *note*: [using GDB](#GDB) works only if code is in .text 181 | 182 | defining a section is easy. just put a . plus the name of the section (like .bss or .text) and then everything after that in the file is part of that section. you can make multiple instances of the same section in different parts of your program (for example two .data sections) and the assembler (gcc) will make sure everything is combined into one. 183 | 184 | ### text 185 | 186 | in .text code is stored. you write your program in this section. make sure you do this for [GDB](#GDB) to work. 187 | 188 | ### data 189 | 190 | in .data small variables (integers, text) is stored to be used in your program 191 | 192 | ### bss 193 | 194 | in .bss data can also be stored. the difference is that bss data *must* be uninitialized. this is the case because all of the other sections will actually become a part of the executable file, while the bss section is only a 'promise' for the os. when the program runs the space is created in ram by the os. if you define large arrays of data this should be done in bss to keep the executable small 195 | 196 | ### rodata 197 | 198 | rodata should be used (and is optimized for) storing constant data. this section can *only* be read from. 199 | 200 | ## X86 Calling Convention 201 | The calling convention (System V AMD64 ABI) that is used on \*nix systems is as follows. *for __64__ bit programs only* 202 | The first six integer or pointer arguments passed in the registers in this order: 203 | 1. `RDI` 204 | 2. `RSI` 205 | 3. `RDX` 206 | 4. `RCX` 207 | 5. `R8` 208 | 6. `R9` 209 | 7. (with sometimes `R10` as a static chain pointer in case of nested functions) 210 | 8. Additional arguments are to be passed on to the stack 211 | 212 | The return values are stored in `RAX` (In case of a 64 bit number) and in `RDX:RAX` (MSB:LSB) in case of 128 bit numbers. 213 | 214 | [Source \(x86 Calling Conventions Wikipedia\)](https://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI) 215 | 216 | An illustration of how C functions are called in respect to the x86_64 SysV calling convention: 217 | ![args](https://user-images.githubusercontent.com/10385659/45920669-305d3c80-bea8-11e8-932f-f198d48c4e2d.jpg) 218 | 219 | ## GDB 220 | 221 | GDB is a debugger which can help find segfaults or find other mistakes in your program. to use it compile it using the *-g* option (put it directly after "gcc") and then instead of running it like ./, you run it as gdb ./. this should launch you into a gdb environment. in this environment you can use the following commands: 222 | 223 | * b n (or breakpoint). this sets a breakpoint on line n 224 | * print code. this prints whatever you specify in code. this can be a full c expression, or a register name (e.g. $rdi or $rax) 225 | * x/nx p print n 32 bit words after p. p can be an adress or register. this is useful for reading whats on the stack (e.g. x/10x $rbp) 226 | * n (or next) steps ahead one instruction. when it finds a function call it will not step into instructions inside this function. useful to skip large functions like c stdlib function like printf 227 | * s (or step) steps ahead one instruction. this one does go into large functions 228 | * r (or run) runs the program until the next breakpoint or the end 229 | * c (or continue) after a breakpoint, continue restarts execution like run did until it encounters another breakpoint or the program ends. useful if a breakpoint is in a loop and you want to go to the next iteration 230 | * start starts the program, places a breakpoint on line one so you can imediately start using s and n 231 | 232 | when using GDB your program *must* be compiled with -g and your code *must* be in a .text section 233 | 234 | ## command line arguments 235 | 236 | Getting command line arguments is easy in assembly. basically it works the same as in C. The main function/label is actually called with 2 arguments in rdi and rsi. rdi is the ammount of arguments, and rsi is a pointer to an array of strings which holds the arguments. you know where the array ends with argc/rdi. 237 | 238 | ## Handy Links 239 | * [reference of linux syscalls](http://syscalls.kernelgrok.com/) 240 | * [quick assembly cheatsheet](https://www3.nd.edu/~dthain/courses/cse40243/fall2015/intel-intro.html) 241 | * [quick assembly cheatsheet 2](https://www.cs.uaf.edu/2005/fall/cs301/support/x86/index.html) 242 | * [quick assembly cheatsheet 3](https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf) 243 | -------------------------------------------------------------------------------- /computer-organisation/not-assembly.md: -------------------------------------------------------------------------------- 1 | # Computer Organisation 2 | FAQ For Computer Organisation 3 | 4 | ## Table Of Contents 5 | 6 | 1. [Base conversion](#Base-Conversion) 7 | 1. [Division method](#division-method) 8 | 2. [Subtraction method](#subtraction-method) 9 | 3. [Divisible bases](#divisible-bases) 10 | 11 | 2. [Number representations](#number-representations) 12 | 1. [Binary coded decimal (BCD)](#binary-coded-decimal-bcd) 13 | 2. [Sign and magnitude](#sign-and-magnitude) 14 | 3. [1s complement](#1s-complement) 15 | 4. [2s complement](#1s-complement) 16 | 5. [Excess-n](#excess-n) 17 | 6. [Fixed point](#fixed-point) 18 | 7. [Floating point (single precision)](#floating-point) 19 | 20 | 3. [Helpful links](#helpful-links) 21 | 22 | ## Base Conversion 23 | 24 | ### Division method: 25 | 26 | take any integer x in base a. to convert it to base b, keep dividing x by b. the remainder after every division is the next digit in the number of base b. 27 | 28 | Example: 29 | ``` 30 | convert the decimal number 1249 to ternary: 31 | 32 | 1249 / 3 = 416 remainder 1 33 | 416 / 3 = 138 remainder 1 34 | 138 / 3 = 46 remainder 0 35 | 46 / 3 = 15 remainder 1 36 | 5 / 3 = 5 remainder 0 37 | 5 / 3 = 1 remainder 2 38 | 1 / 3 = 0 remainder 1 39 | 40 | Therefore the ternary number corresponding to the decimal 1249 is 1201011 (Read from bottom to top). 41 | 42 | ``` 43 | 44 | ### Subtraction method: 45 | 46 | This method is usually the easiest when converting to binary. 47 | 48 | ``` 49 | Convert the decimal number 3689 to binary: 50 | 51 | powers of 2: 52 | 2^0 = 1 53 | 2^1 = 2 54 | 2^2 = 4 55 | 2^3 = 8 56 | 2^4 = 16 57 | 2^5 = 32 58 | 2^6 = 64 59 | 2^7 = 128 60 | 2^8 = 256 61 | 2^9 = 512 62 | 2^10 = 1024 63 | 2^11 = 2048 64 | 65 | 3689 - 2048 = 1641 (therefore the 12th bit of the binary number is 1) 66 | 1641 - 1024 = 617 (therefore the 11th bit of the binary number is 1) 67 | 617 - 512 = 105 (therefore the 10th bit of the binary number is 1) 68 | 105 - 256 = negative (therefore the 9th bit of the binary number is 0) 69 | 105 - 128 = negative (therefore the 8th bit of the binary number is 0) 70 | 105 - 64 = 41 (therefore the 7th bit of the binary number is 1) 71 | 41 - 32 = 9 (therefore the 6th bit of the binary number is 1) 72 | 9 - 16 = negative (therefore the 5th bit of the binary number is 0) 73 | 9 - 8 = 1 (therefore the 4th bit of the binary number is 1) 74 | 1 - 4 = negative (therefore the 3th bit of the binary number is 0) 75 | 1 - 2 = negative (therefore the 2th bit of the binary number is 0) 76 | 1 - 1 = 0 (therefore the 2th bit of the binary number is 1) 77 | 78 | the binary representation of 3689 is 111001101001 (read from top to bottom) 79 | ``` 80 | 81 | ### Divisible bases 82 | 83 | In the case where the base of number a to the power n is the base of number b, a special technique can be used: 84 | 85 | ``` 86 | convert the hexadecimal number 1BADB002 to quaternary (props for who gets this reference) 87 | 88 | 89 | 4 ^ *2* = 16, therefore we can use every *2* digits in quaternary and read them as 1 digit in hexadecimal. 90 | 91 | quaternary -- hexadecimal 92 | 93 | 00 = 0 94 | 01 = 1 95 | 02 = 2 96 | 03 = 3 97 | 10 = 4 98 | 11 = 5 99 | 12 = 6 100 | 13 = 7 101 | 20 = 8 102 | 21 = 9 103 | 22 = a 104 | 23 = b 105 | 30 = c 106 | 31 = d 107 | 32 = e 108 | 33 = f 109 | 110 | 1 --> 01 111 | B --> 23 112 | A --> 22 113 | D --> 31 114 | B --> 23 115 | 0 --> 00 116 | 0 --> 00 117 | 2 --> 02 118 | 119 | therefore 1BADB002 in hexadecimal is 0123223123000002 in quaternary 120 | ``` 121 | 122 | ## Number Representations 123 | 124 | ### Binary coded decimal (BCD) 125 | 126 | BCD is the most understandable way to represent a decimal number in binary. Every digit in the decimal number will be represented by 4 bits (**b**inary dig**its**). The decimal digit 0 will be represented as 0000, 1 as 0001, 2 as 0010 ... and 9 as 1001. The number 2490 will be represented as: 0010 0100 1001 0000. This system isn't very efficient, but it is easy to understand for humans. 127 | 128 | ### Sign and Magnitude 129 | 130 | To represent negative binary numbers a number of systems can be used. Sign and magnitude is one. 131 | 132 | With sign and magnitude, the most significant bit of any binary number specifies the sign of the number. if it's 1 then the number is negative, else positive. 133 | 134 | This makes 100101 negative 5 and 01001 positive 9 135 | 136 | Sign and magnitude is the easiest representation with negatives for humans to read, but the hardest for computers to actually calculate with. 137 | 138 | range: for n bits, (-2^n-1) + 1 -- (2^n-1)-1, has both positive and negative 0. for 4 bits: -7...-0.+0...+7 139 | 140 | ### 1s complement 141 | 142 | 1s complement is a lot easier (But still not amazing) for computers to calculate with, and it is also quite readable by humans. 1s complement is the same as sign and magnitude, but when the sign is negative, all other bits are inverted. 143 | 144 | This makes 100101 negative 26 and 01001 positive 9. 145 | 146 | Range: for n bits, (-2^n-1) + 1 -- (2^n-1)-1, has both positive and negative 0. for 4 bits: -7...-0.+0...+7 147 | 148 | ### 2s complement 149 | 150 | 2s complement is the hardest representation for negative whole numbers for humans to read, but the easiest and most efficient for computers to work with. That iss why it is almost always used inside CPUs. 2s complement is the same as adding 1 to the corresponding 1s complement number, whenever it's negative. 151 | 152 | This makes 100101 negative 27, and 01001 still positive 9. 153 | 154 | Range: for n bits, (-2^n-1) -- (2^n-1)-1, has both positive and negative 0. for 4 bits: -8...0...+7 155 | 156 | #### 2s complement math 157 | Addition: Addition in 2s complement is very easy you just add the two numbers together like you normally would (this even works with negative numbers and is the reason why it is used in computers so much). 158 | 159 | Subtraction: Subtraction is the same as adding a positive and a negative number, so that is exactly how you do subtraction in 2s complement: You first make the value you are subtracting negative (invert and add one) and then you just add. 160 | 161 | ### Excess-n 162 | 163 | Excess-n (or binary offset) representation is just normal binary representation with an offset n and works the following: 164 | 165 | * The smallest binary number represents the smallest value (0 − excess) 166 | * The greatest binary number represents the largest value (2^(n+1) − excess − 1) 167 | 168 | Here is an example of Excess-3 169 | 170 | |Decimal|Excess-3|Binary| 171 | |-------|--------|------| 172 | |-3 |0000 | N/A | 173 | |-2 |0001 | N/A | 174 | |-1 |0010 | N/A | 175 | |0 |0011 | 0000 | 176 | |1 |0100 | 0001 | 177 | |2 |0101 | 0010 | 178 | |3 |0110 | 0011 | 179 | |4 |0111 | 0100 | 180 | |... |... | ... | 181 | 182 | 183 | 184 | ### Fixed point 185 | 186 | With fixed point number representaion, a binary number is taken and a place is decided where the decimal point will go. In the following examples of fixed point numbers the decimal point will come after 5 bits of integer and before 5 bits of fraction. 187 | 188 | Binary numbers in fixed point continue the pattern of each successive bit being worth half of the last. this makes the values of each digit in a number as follows: 189 | ``` 190 | 16 8 4 2 1 . 1/2 1/4 1/8 1/16 1/32 191 | ``` 192 | 193 | Examples: 194 | ``` 195 | 00000.00000 is binary for the decimal number 0.0 196 | 10000.00000 is binary for the decimal number 16.0 197 | 10001.11000 is binary for the decimal number 17.75 198 | ``` 199 | 200 | Advantages of fixed point are the relatively easy implementation of them in CPUs, the disatvantage is that you can neither make very big nor very precise numbers at the same time. Depending on the place of the decimal point either the precision or magnitude can be very big. 201 | 202 | ### Floating point 203 | 204 | Floating point is very different to the other representations. 205 | 206 | A single precision float consists of: 207 | 208 | 1 bit: sign (1 = negative, 0 = positive) 209 | 8 bit: exponent (excess-127 number) 210 | 23 bit: mantissa (1.xxxxxx assumed) 211 | 212 | example: 213 | ``` 214 | 0 10000010 10100000000000000000000 215 | + 130 == 3 in e-127 1.101 moving the decimal point 3 places to the right makes 1101.0 == 13 216 | ``` 217 | ## Helpful links 218 | * [Bases](https://www.ceafinney.com/miscellania/bases.html) 219 | 220 | * [Multiplexers and Decoders](https://www.youtube.com/watch?v=HU31Wh-4_K8) 221 | 222 | -------------------------------------------------------------------------------- /docs/documentup.js: -------------------------------------------------------------------------------- 1 | this.DocumentUp = {}; 2 | 3 | DocumentUp.document = function (opts) { 4 | var repo; 5 | if ("string" === typeof opts) { 6 | repo = opts; 7 | opts = null; 8 | } else { 9 | repo = opts.repo; 10 | delete opts.repo; 11 | } 12 | 13 | window.callback = function (resp) { 14 | if (resp.status === 200) { 15 | document.open(); 16 | document.write(resp.html); 17 | document.close(); 18 | if (opts && opts.afterRender && typeof opts.afterRender === "function") 19 | opts.afterRender() 20 | } 21 | } 22 | 23 | var script = document.createElement('script'); 24 | script.src = '//documentup.com/'+repo 25 | if (opts) 26 | script.src += "?config="+encodeURIComponent(JSON.stringify(opts))+'&callback=callback'; 27 | else 28 | script.src += "?callback=callback"; 29 | 30 | document.getElementsByTagName('head')[0].appendChild(script); 31 | } -------------------------------------------------------------------------------- /docs/documentup.min.js: -------------------------------------------------------------------------------- 1 | this.DocumentUp={},DocumentUp.document=function(a){var b;"string"==typeof a?(b=a,a=null):(b=a.repo,delete a.repo),window.callback=function(b){b.status===200&&(document.open(),document.write(b.html),document.close(),a&&a.afterRender&&typeof a.afterRender=="function"&&a.afterRender())};var c=document.createElement("script");c.src="//documentup.com/"+b,a?c.src+="?config="+encodeURIComponent(JSON.stringify(a))+"&callback=callback":c.src+="?callback=callback",document.getElementsByTagName("head")[0].appendChild(c)} -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSEdelft/FAQ/e2e518e233caa2a9a35f4989e2641d0c2903698e/docs/favicon.ico -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: -------------------------------------------------------------------------------- /git/README.md: -------------------------------------------------------------------------------- 1 | # Quick video tutorial 2 | 3 | If you've got 30 minutes of time, these two videos will teach you how to work with git in the command line so that you can quickly start collaborating on github using git. Git and github will make more sense after this, promised. 4 | 5 | 1. Git and Source Control Basics 6 | https://www.youtube.com/watch?v=0fKg7e37bQE 7 | 2. Pull requests, Branching, Merging & Team Workflow 8 | https://www.youtube.com/watch?v=oFYyTZwMyAg 9 | 10 | # essential git commands 11 | 12 | 13 | ## make a new repository 14 | 15 | go to https://github.com/new 16 | make a new repository 17 | 18 | ```bash 19 | 20 | cd 21 | 22 | git init 23 | git remote add origin https://github.com/username/repository 24 | 25 | 26 | ``` 27 | ## upload local changes 28 | 29 | ```bash 30 | 31 | git add . #add all files you added locally 32 | git commit -a -m "tell here what you changed in a few words" 33 | git push origin master 34 | 35 | ``` 36 | 37 | ## commit local changes 38 | 39 | (this just saves your progress, does not actually upload it. *_DO THIS OFTEN_*) 40 | 41 | ```bash 42 | 43 | git add . #add all files you added locally 44 | git commit -a -m "tell here what you changed in a few words" 45 | 46 | ``` 47 | 48 | ## download all changes from github to your computer 49 | 50 | ```bash 51 | 52 | git pull origin master 53 | 54 | ``` 55 | 56 | ## revert to an old commit (watch out with this) 57 | 58 | ```bash 59 | 60 | git reset --hard 61 | git push -f origin master 62 | 63 | ``` 64 | 65 | 66 | ## resolve conflicts 67 | 68 | do this if you get a message similar to this: 69 | 70 | 71 | ```bash 72 | >> git push 73 | 74 | To https://github.com/username/repositoryname 75 | ! [rejected] master -> master (fetch first) 76 | error: failed to push some refs to 'https://github.com/username/repositoryname' 77 | hint: Updates were rejected because the remote contains work that you do 78 | hint: not have locally. This is usually caused by another repository pushing 79 | hint: to the same ref. You may want to first integrate the remote changes 80 | hint: (e.g., 'git pull ...') before pushing again. 81 | hint: See the 'Note about fast-forwards' in 'git push --help' for details. 82 | ``` 83 | 84 | this means other people have pushed things while you changed your version too. 85 | 86 | ```bash 87 | 88 | git branch 89 | git push origin 90 | 91 | ``` 92 | 93 | now go to https://github.com/username/repositoryname/pulls 94 | create new pull request 95 | 96 | select master <- 97 | 98 | type some text about why you think this feature should be added to master 99 | assign people for review on the right (optional but reccommended) 100 | 101 | click create pull request. 102 | 103 | now wait... until someone accepts it :) 104 | 105 | ## accept a pull request 106 | 107 | there are 2 options: 108 | 109 | either there are no conflicts and the branches can be merged or there are conflicts. 110 | 111 | ### no conflicts 112 | 113 | 114 | this is easy: just click merge. now to start working with this new version use 115 | 116 | ```bash 117 | git pull origin master 118 | ``` 119 | 120 | 121 | ### conflicts 122 | 123 | click resolve conflicts 124 | you will get a list of all files that have conflicts. click each one and you'll see what changes are made in both branches. Edit the file until all >>>>> and <<<<< sections are gone. keep everything you want to keep and remove everything that can be removed from the files. when you're done and resolved all conflicts you can safely merge. 125 | 126 | 127 | ## gitignore files 128 | 129 | it is not wise to have large files or folders on github. use a file called ".gitignore" in the root of your repository to exclude files from your project 130 | 131 | 132 | this file can have a structure like this: 133 | 134 | ```gitignore 135 | 136 | *.java 137 | secretpasswords.json 138 | 139 | node_modules/ 140 | 141 | 142 | ``` 143 | 144 | from the moment you make this gitignore file, any file that match these patterns and wasn't previously on the repository will not be pushed anymore. 145 | 146 | 147 | ### apply gitignore file on existing files in repositoryname 148 | 149 | ```bash 150 | 151 | git rm -r --cached . 152 | git add . 153 | git commit -a -m "applied gitignore" 154 | git push 155 | 156 | ``` 157 | 158 | ## remove any changes you made after you last pulled (reset to whatever is in the remote repository) 159 | 160 | *_watch out. this removes anything you made since the last pull_* 161 | 162 | ```bash 163 | git fetch origin 164 | git reset --hard origin/master 165 | 166 | ``` 167 | 168 | ### save current progress before reset 169 | 170 | if you want to reset but maybe later return to whatever you had before the reset, do this: 171 | 172 | ```bash 173 | 174 | git commit -a -m "saving my work" 175 | git branch mysavedwork 176 | 177 | ``` 178 | 179 | now you can do the fetch and reset. 180 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /object-oriented-programming/BasicsToJava.md: -------------------------------------------------------------------------------- 1 | # Object-oriented programming 2 | FAQ / Crash course for Java (OOP). 3 | 4 | ## Table of contents 5 | *** 6 | 1. [Syntax and conventions](#syntax-and-conventions) 7 | 1. [Definitions](#definitions) 8 | 2. [Primitive types](#primitive-types) 9 | 3. [Modifiers](#modifiers) 10 | 4. [Naming conventions](#naming-conventions) 11 | 2. [Operators](#operators) 12 | 1. [Arithmetic](#arithmetic) 13 | 2. [Relational](#relational) 14 | 3. [Logical](#logical) 15 | 4. [Bitwise](#bitwise) 16 | 5. [Assignment](#assignment) 17 | 6. [Miscellaneous](#miscellaneous) 18 | 3. [Control statements](#control-statements) 19 | 1. [Conditional Execution](#conditional-execution) 20 | 2. [Loops](#loops) 21 | 3. [Flow control](#flow-control) 22 | 4. [Objects](#objects) 23 | 1. [Instantiation](#instantiation) 24 | 2. [Instance variables vs class variables](#instance-variables-vs-class-variables) 25 | 3. [Inheritance](#inheritance) 26 | 4. [Abstraction](#abstraction) 27 | 5. [Interfaces](#interface) 28 | 5. [I/O](#i/o) 29 | 1. [Files](#files) 30 | 2. [Console](#console) 31 | 6. [Tests](#tests) 32 | 6. [Running everything](#running-everything) 33 | 7. [Helpful links and credits](#helpful-links-and-credits) 34 | 35 | ## Syntax and conventions 36 | *** 37 | This guide will be useful for everyone who wasn't able to get a good grasp on the topics during the lecture, was half-asleep at 8:45 in the morning, or simply wants to brush up their knowledge of the beautiful thing that is called Java. But before we get you on your way in your Java career, there a few things that will be helpful to know in your Java learning pursuits. Let's discuss those first. 38 | 39 | ### Definitions 40 | **JVM:** The JVM, or Java Virtual Machine, is the virtual machine that executes java bytecode. Your knowledge of this beautiful piece of software doesn't have to be too extensive. All you have to know is that the JVM makes sure your code works on several platforms, without you having to rewrite it several times. 41 | 42 | **JRE:** The JRE, or the Java Runtime Environment, contains all libraries, the JVM and any other necessary components to run your Java program. 43 | 44 | **JDK:** The JDK, or the Java Development Kit, contains everything in the JRE, plus some extra goodies like compilers and debuggers. Useful for us! 45 | 46 | **Object:** Now that we're done with the three letter definitions, we can continue with the useful stuff. An object is essentially a container for a set of states/behaviours (you could call this variables) and methods to interact with them. For example, a car has multiple different states and behaviours: color, brand, type, top speed, driving, out of gas. An object is an instance of a Class. 47 | 48 | **Class:** You could see this as an template for Objects. In a Class you define the (default) states and behaviours of your Object. In the previous example of a car, you would define your Class as 'a car has a color which defaults to red, a brand and top speed that you define when creating a new car, and is by default not driving...' 49 | 50 | **Method:** A method is the actual behavior of your object. This is where you write your logic and manipulate data. 51 | 52 | **Instance Variables:** I've mentioned 'states' several times now, but what are states actually? They are defined with instance variables, which keep track of the current states of your object. Instance variables are like the normal variables you've heard about, but they're 'owned' by an object. If this definition sounds a bit vague, don't worry, instance variables will be discussed later on. 53 | 54 | **Constant:** These are just like the regular physics constants you've learned about in high school, but in this case you can actually define them. Constants are just like normal variables, with one small detail: they can be set/changed/assigned only once. You'd normally prefix these variables with '*final*', and often '*static*'. 55 | 56 | ### Primitive Types 57 | You've probably heard about these in lectures or came across one yourself (if not, you probably did see one, but didn't know it was a primitive): primitives. Just like in most other languages, Java has a set of primitive types, which you use to store the most basic types of data. Even if you somehow end up not directly writing them yourself, these are somehow used in everything you make. They are the building blocks of data manipulation. 58 | 59 | **boolean:** This is about as basic as we can get, while still maintaining functionality. This type stores one of two possible states: true or false. So if you would want to store something like something being either enabled of disabled, this is the thing for you. 60 | 61 | **byte:** You won't see this type often, but it can be used to save some space in some cases. As the name suggests this is an 8-bit integer, which means it can store values from -128 to +127. From the range you probably noticed something: it's an signed integer. That's because Java's primitives only store signed numbers, not unsigned. From now on I won't mention this anymore, because I assume you know. 62 | 63 | **short:** This is also an integer value. This time of 16-bit, so that's -32,769 to +32,767. 64 | 65 | **int:** You probably have seen this one already, since it's the 'normal' integer value. An int is a 32-bit value, so it's range is -2,147,483,648 - +2,147,483,647. 66 | 67 | **long:** Another integer value. As the name suggests it can store bigger numbers than int. Since long is a 64-bit value, you can store anything between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807. You normally use this type when a function requires it, or when an int cannot store your desired number. 68 | 69 | **float:** This is just a 32-bit floating-point value. 70 | 71 | **double:** This is also a floating-point value, 64-bits this time. Watch out for [rounding off errors](https://www.geeksforgeeks.org/rounding-off-errors-java/) when using doubles and floats. 72 | 73 | **char:** A char is a single 16-bit [Unicode](https://en.wikipedia.org/wiki/List_of_Unicode_characters) character. It can store values between '\u0000' and '\uffff'. 74 | 75 | Should you prefer a more visual list of the primitive types: 76 | ![primitive_data_type](https://user-images.githubusercontent.com/41565823/46495600-1f9cb700-c816-11e8-9a29-a961a3be48eb.png) 77 | 78 | #### Special mentions 79 | **String:** While technically not a primitive type, a string will usally be part of any program. It is made up of an array of chars. 80 | 81 | **Wrapper Types:** You may have come across classes like 'Integer' and 'Double' and wondered what the difference between those and primitive types are. These exists so you can use them in instances where an Object is required (try making an ArrayList with primitives). These can be used interchangeably with primitive types, but you should use primitive types whenever possible. 82 | 83 | ### Modifiers 84 | Modifiers can be applied to a number of things: classes, variables and methods. They provide funtionality and control access to data. 85 | 86 | #### Access control 87 | These modifiers change the accessibility of data. It it generally best to be as restrictive as possible. 88 | 89 | **public:** Externally visible from an instance of the class. You can acces this data from anywhere. 90 | 91 | **protected:** This modifier makes something visible from inside the class, from the package and from any subclasses of the class. 92 | 93 | **no modifier:** Without a modifier the data is accessible from anywhere within the same package 94 | 95 | **private:** This modifier make something visible only to the class which contains it. 96 | 97 | If you like tables better: 98 | 99 | | | Class | Package | Subclass (same package) | Subclass (different package) | World | 100 | | ----------- | :-----: | :-------: | :-----------------------: | :----------------------------: | :---: | 101 | | public | + | + | + | + | + | 102 | | protected | + | + | + | + | - | 103 | | no modifier | + | + | + | - | - | 104 | | private | + | - | - | - | - | 105 | *+ = accessible* 106 | *- = not accessible* 107 | 108 | #### Other modifiers 109 | There are several other modifiers besides the two down below, but you won't use them as much. If you need more a list can be found [here](https://docstore.mik.ua/orelly/java-ent/jnut/ch03_14.htm). 110 | 111 | **static:** This one is for class-level methods and variables. If you use this modifier, the data will remain constant rather than being controlled by individual instances. 112 | 113 | **final:** As I quickly mentioned in definitions, the final modifier is used to define constants. When you use this modifier Java will not allow any changes to the data, except for the initial assignment (in class or constructor). 114 | 115 | ### Naming conventions 116 | Naming conventions are simply a set of rules to follow when deciding on names for your classes, packages, variables, methods and so on. These rules make it easier for you and other people to follow and understand your code. Nobody is forcing you to follow these conventions, but the future you and your peers will be thankful if you do. If you've programmed in another language for years and don't want to drop those naming conventions: no problem, but just make sure your code is clear and readable. 117 | 118 | **Classes:** Classes should be named in UpperCamelCase. Examples: Lawyer, Prosecutor, Car. 119 | 120 | **Methods:** Methods should be named in lowerCamelCase. Examples: submitAssignment(), isAwesome(), bufferScreen(). 121 | 122 | **Variables:** These should also be named in lowerCamelCase. Example: settingsFrame, keyPair, corePoolThreads. 123 | 124 | **Packages:** Packages should be in lowercase. The regular structure of a package name is: .[.]. This is to avoid clashes. You probably don't own a domain name, so me..[.] should suffice. Example: nl.tudelft.peer 125 | 126 | **Constants:** Constants should be in uppercase. Example: public static final float GUESSING_CORRECTION = -2.5; 127 | 128 | Another important part of naming conventions is giving things *meaningful* names. If I read your code I should be able to understand what your functions do and what data your variables hold, without having to investigate. 129 | 130 | ## Operators 131 | *** 132 | These things called operators are used to use and manipulate variables. 133 | 134 | ### Arithmetic 135 | Arithmetic operators are used in mathematical expressions in the same you would use them in algebra. These symbols mostly speak for themselves (A = 10 & B = 5): 136 | 137 | | Operator | Name | Operation | Result | 138 | | :------: | :--: | :-------: | :----: | 139 | | + | Addition | A + B | 15 140 | | - | Subtraction | A - B | 5 141 | | * | Multiplication | A * B | 50 142 | | / | Division | A / B | 2 143 | | % | Modulus | A % B | 0 144 | | ++ | Increment | A++ | A == 11 145 | | -- | Decrement | B-- | B == 5 146 | 147 | ### Relational 148 | These operators are relatively easy too. These operators can be used in conditional statements, where they act as a boolean (A = 10 & B = 5): 149 | 150 | | Operator | Name | Operation | Result | 151 | | :------: | :--: | :-------: | :----: | 152 | | == | Equal to | A == B | false 153 | | != | Not equal to | A != B | true 154 | | > | Greater than | A > B | true 155 | | < | Less than | A < B | false 156 | | >= | Greater than or equal to | A >= B | true 157 | | <= | Less than or equal to | A <= B | false 158 | 159 | ### Logical 160 | Logical operators are used to return a boolean based on the boolean result of multiple expressions. These are so called lazy operators: Java will only evaluate operand if they can still change the result. So if the expression is something like '*false && A % B == 0*', Java will not bother evaluating the second operand, because its result cannot change the final result. You can read why you might want this [here](https://stackoverflow.com/questions/7101992/why-do-we-usually-use-not-what-is-the-difference). 161 | 162 | | Operator | Name | Operation | Result | 163 | | :------: | :--: | :-------: | :----: | 164 | | && | And | 5 - 1 == 4 && 10 % 2 == 0 | true 165 | | || | Or | 5 - 1 == 3 || 10 % 2 == 0 | true 166 | | ! | Not | !(5 - 1 == 4) | false 167 | 168 | ### Bitwise 169 | I doubt we'll need these operators for OOP, but for the sake of completion and to quench your thirst for knowledge I will still add these to the guide. Bitwise operators work just like they do in Computer Organisation / Reasoning and Logic: 170 | 171 | | Operator | Name | Example | R & L Equivalence | Result (Decimal) | Result (Binary) | 172 | | :------: | :---: |:--: | :-------: | :---: | :---: | 173 | | & | AND | 60 & 13 | A ∧ B | 12 | 0000 1100 174 | | | | OR | 60 | 13 | A ∨ B | 61 | 0011 1101 175 | | ^ | XOR | 60 ^ 13 | A ⨁ B | 49 | 0011 0001 176 | | ~ | NOT | ~(60) | ¬A | -61 | 1100 0011 177 | | << | Shift left | 60 << 2 | NaN | 240 | 1111 0000 178 | | >> | Shift right | 60 >> 2 | NaN | 15 | 1111 179 | | >>> | Shift right zero | 60 >>> 2 | NaN | 15 | 0000 1111 180 | 181 | ### Assignment 182 | These operators are used to assign values to variables. 183 | 184 | | Operator | Example | Equivalent to | 185 | | :------: | :--: | :-------: | 186 | | = | A = B | A = B 187 | | += | A += B | A = A + B 188 | | -= | A -= B | A = A - B 189 | | *= | A *= B | A = A * B 190 | | /= | A /= B | A = A / B 191 | | %= | A %= B | A = A % B 192 | | <<= | A <<= B | A = A << B 193 | | >>= | A >>= B | A = A >> B 194 | | &= | A &= B | A = A & B 195 | | ^= | A ^= B | A = A ^ B 196 | | |= | A |= B | A = A | B 197 | 198 | ### Miscellaneous 199 | There are two useful operators outside of those categories. 200 | 201 | **? (Conditional Operator):** A conditional operator is used to evaluate a boolean value and decide what value should be there based on the boolean. You could see this as a shorter if-statement. For example: 202 | ```java 203 | // This function is equal to the second one 204 | private String getPassword() 205 | { 206 | return this.password == null ? "no password" : this.password; 207 | } 208 | 209 | private String getPassword() 210 | { 211 | if (this.password == null) 212 | { 213 | return "no password"; 214 | } 215 | 216 | return this.password; 217 | } 218 | ``` 219 | 220 | **instanceof:** This operator is used to check if an object is of a particular type: 221 | ```java 222 | private boolean isString(Object object) 223 | { 224 | return instanceof String; 225 | } 226 | 227 | // This will return true: 228 | isString("string"); 229 | // This will return false: 230 | isString(new Integer(5)); 231 | ``` 232 | 233 | ## Control statements 234 | *** 235 | The statements in your source code are normally executed from top to bottom. However, control statements allow you to break up the flow execution. This allows for far more complex functionality. 236 | 237 | ### Conditional Execution 238 | As the name suggest, these statements allow for code to be executed if a certain condition is met. 239 | 240 | **If statement:** This is the most basic conditional statement. An if statement evaluates some expression, and executes some code if the expression was true. Example: 241 | ```java 242 | if (A == B) 243 | { 244 | System.out.println("A is equal to B!"); 245 | } 246 | ``` 247 | ![ifelse-flowchart-365x300](https://user-images.githubusercontent.com/41565823/46495943-0ba58500-c817-11e8-8f9c-3222474c94fe.png) 248 | 249 | **if ... else statement:** This is a normal if statement, with a small twist: if the expression in the if statement was false, the code in the else block will be executed. If the expression was true, this expression behaves just like a normal if statement would. Example: 250 | ```java 251 | if (A == B) 252 | { 253 | System.out.println("A is equal to B!"); 254 | } else 255 | { 256 | System.out.println("A is NOT equal to B!"); 257 | } 258 | ``` 259 | You can also combine an else with an if to create an *else if* block. In this case you can check several expressions before you jump to an else block. Example: 260 | ```java 261 | if (A == B) 262 | { 263 | System.out.println("A is equal to B!"); 264 | } else if (A < B) 265 | { 266 | System.out.println("A is less than B!"); 267 | } else 268 | { 269 | System.out.println("A is greater than B!"); 270 | } 271 | ``` 272 | 273 | **Nested if statements:** You can use the above statements inside other (else) if blocks: 274 | ```java 275 | if (A != B) 276 | { 277 | if (A < B) 278 | { 279 | System.out.println("A is less than B!"); 280 | } else 281 | { 282 | System.out.println("A is greater than B!"); 283 | } 284 | } else 285 | { 286 | System.out.println("A is equal to B!"); 287 | } 288 | ``` 289 | 290 | **Switch statements:** Moving on, we have switch statements. The switch statement defines multiple paths for execution of a set of statements. It is a better alternative than using a large set of if-else statements as it is a multi-way branch statement. 291 | 292 | Refer to the following flowchart to get a better understanding of switch statements: 293 | ![switchstatement-java-271x300](https://user-images.githubusercontent.com/41565823/46496005-32fc5200-c817-11e8-81c2-5c0640f11103.png) 294 | 295 | A switch statement compares the given variable to a list of possible values. You can also define a default value, which will trigger if the given value is not equal to any of the values in your list. An example would be: 296 | 297 | ```java 298 | private String getDay(int dayInWeek) 299 | { 300 | String currentDay = ""; 301 | 302 | switch (dayInWeek) 303 | { 304 | case 1: 305 | currentDay = "Monday"; 306 | break; 307 | case 2: 308 | currentDay = "Tuesday"; 309 | break; 310 | case 3: 311 | currentDay = "Wednesday"; 312 | break; 313 | case 4: 314 | currentDay = "Thursday"; 315 | break; 316 | case 5: 317 | currentDay = "Friday"; 318 | break; 319 | case 6: 320 | currentDay = "Saturday"; 321 | break; 322 | case 7: 323 | currentDay = "Sunday"; 324 | break; 325 | default: 326 | currentDay = "Invalid day"; 327 | break; 328 | } 329 | 330 | return currentDay; 331 | } 332 | 333 | System.out.println("Today is " + getDay(1)); // Result: "Today is Monday" 334 | System.out.println("Today is " + getDay(7)); // Result: "Today is Sunday" 335 | System.out.println("Today is " + getDay(-1)); // Result: "Today is Invalid day" 336 | ``` 337 | 338 | **Conditional operator:** I talked about this [earlier](#miscellaneous), but the conditional operator can be used in place of if statements in some cases. 339 | 340 | ### Loops 341 | 342 | 343 | *Not these loops* 344 | 345 | Loops can execute code multiple times. So instead if writing a certain statement 5 times, you can use one nice loop. There are a few different types of loops. 346 | 347 | **While loop:** These loops repeat a certain block of code, *while* the expression is true. Before each execution the statement will be checked; if the expression is true the loop will execute, otherwise it will break and continue normal execution. As with any other loops inifite loops are something you have to watch out for, but while loops have a higher 'infinite loop potential' than other loops. Example: 348 | ```java 349 | int i = 0; 350 | 351 | while (i < 5) 352 | { 353 | System.out.println("Hi."); 354 | i++; // This line is important, without it this loop would become infinite! 355 | } 356 | ``` 357 | 358 | **Do..while loop:** This loop is the same as a while loop with one big difference: Instead of checking the loop expression before execution, this loop will check the expression *after* execution. 359 | 360 | **For loop:** A for loop is a compact method for iterating over a range of values. The standard form is: 361 | ```java 362 | for (initialization of variable; continuation case; increment) 363 | { 364 | // code goes here 365 | } 366 | ``` 367 | The first part is where you initialize a variable to be looped upon. The continuation case is an expression which must be true in order for the code to be executed. Increment is where you increment your initialized variable towards the termination. An example: 368 | ```java 369 | for (int i = 0; i < 5; i++) 370 | { 371 | System.out.println("Hi, for the " + i + "th time!"); 372 | } 373 | 374 | // This will print "Hi, for the xst time!" 5 times 375 | // Much better than: 376 | System.out.println("Hi, for the 0th time!"); 377 | System.out.println("Hi, for the 1th time!"); 378 | System.out.println("Hi, for the 2th time!"); 379 | System.out.println("Hi, for the 3th time!"); 380 | System.out.println("Hi, for the 4th time!"); 381 | ``` 382 | *Notice how I used 'i' instead of some descriptive name as I [recommended earlier](#naming-conventions). A quick answer can be found [here](https://softwareengineering.stackexchange.com/questions/86904/why-do-most-of-us-use-i-as-a-loop-counter-variable)* 383 | 384 | **Enhanced for loop:** A few years ago (Java 5) the enhanced for loop was added. This loop is very useful for iterating over a collection of elements such as arrays, lists, and sets. The syntax is simple: 385 | ```java 386 | for (initialization of variable : iterable) 387 | { 388 | // code goes here 389 | } 390 | ``` 391 | Like in the regular for loop, initialization of variable is simply a variable that can be used inside the loop. It may sound more difficult than it actually is: 392 | ```java 393 | int[] numbers = new int[]{1, 3, 3, 7}; 394 | 395 | for (int i : numbers) 396 | { 397 | System.out.println("Current number: " + i); 398 | } 399 | 400 | /* 401 | This would print: 402 | Current number: 1 403 | Current number: 3 404 | Current number: 3 405 | Current number: 7 406 | */ 407 | ``` 408 | 409 | ### Flow control 410 | Flow control statements allow you to specifically control the flow of execution of certain code. In places where code could potentially cause issues if run under certain conditions, these statements are particulary helpful and sometimes even necessary. 411 | 412 | **Return statements:** The return statement has a few different purposes. 413 | In a **void** method (a method with the modifier **void**/does not return a value), this statement can be used to simply exit the method. For example: 414 | ```java 415 | private void runLoop() 416 | { 417 | while (true) 418 | { 419 | if (!shouldBeLooping()) 420 | { 421 | return; 422 | } 423 | 424 | // do something 425 | } 426 | } 427 | ``` 428 | Any value that is not declared **void** has to return something, like this: 429 | ```java 430 | private boolean shouldBeLooping() 431 | { 432 | return running == null ? false : true; 433 | } 434 | ``` 435 | 436 | **Continue statement:** This statement can be used within the body of a loop to skip execution of the following code and move to the next loop iteration. Example: 437 | ```java 438 | for (int i = 0; i < 5; i++) 439 | { 440 | if (i == 2) 441 | { 442 | continue; // If i == 2, then skip to the next iteration 443 | } 444 | 445 | System.out.println(i); 446 | } 447 | 448 | /* 449 | The result would be: 450 | 0 451 | 1 452 | 3 453 | 4 454 | */ 455 | ``` 456 | 457 | **Break statement:** This statement can be used to immediately exit out of a loop. Example: 458 | ```java 459 | for (int i = 0; i < 5; i++) 460 | { 461 | if (i == 3) 462 | { 463 | break; // If i == 3, then break out of loop 464 | } 465 | 466 | System.out.println(i); 467 | } 468 | 469 | /* 470 | The result would be: 471 | 0 472 | 1 473 | 2 474 | */ 475 | ``` 476 | 477 | ## Objects 478 | *** 479 | *Work in progress* 480 | *This is just a baseline, not sure if all these things will be added. If you want a certain topic explained/discussed, you can create an issue on github or send a message on [discord](https://discord.gg/DxH42Ca).* 481 | ### Instantiation 482 | 483 | ### Instance Variables vs Class Variables 484 | 485 | ### Inheritance 486 | 487 | ### Abstraction 488 | 489 | ### Interface 490 | 491 | ## I/O 492 | *** 493 | *Work in progress* 494 | *This is just a baseline, not sure if all these things will be added. If you want a certain topic explained/discussed, you can create an issue on github or send a message on [discord](https://discord.gg/DxH42Ca).* 495 | ### Files 496 | 497 | ### Console 498 | 499 | ## Tests 500 | *** 501 | *Work in progress* 502 | *This is just a baseline, not sure if all these things will be added. If you want a certain topic explained/discussed, you can create an issue on github or send a message on [discord](https://discord.gg/DxH42Ca).* 503 | 504 | ## Running everything 505 | *** 506 | *Work in progress* 507 | *This is just a baseline, not sure if all these things will be added. If you want a certain topic explained/discussed, you can create an issue on github or send a message on [discord](https://discord.gg/DxH42Ca).* 508 | 509 | ## Helpful links and credits 510 | *** 511 | *Work in progess* 512 | 513 | ### Links 514 | You can find some links here, which may be of use to use to you. 515 | #### Codecademy 516 | Codecademy is a website that teaches you to code in an interactive way (for free!) 517 | * [codecademy](https://www.codecademy.com/learn/learn-java) 518 | 519 | #### thenewboston 520 | thenewboston is a youtube channel that has many great programming and science-related tutorials 521 | * [thenewboston - beginner](https://m.youtube.com/playlist?list=PLFE2CE09D83EE3E28) 522 | * [thenewboston - intermediate](https://m.youtube.com/playlist?list=PL27BCE863B6A864E3) 523 | * [thenewboston - java game development](https://m.youtube.com/playlist?list=PLA331A6709F40B79D) 524 | 525 | ### Credits 526 | Since we've signed the Code of Honour I might as well add this too: 527 | * [stackoverflow (several links throughout the guide)](https://www.stackoverflow.com) 528 | * [tutorialspoint - java (tables + definitions)](https://www.tutorialspoint.com/java) 529 | * [SpigotMC (structure + tables + definitions + information)](https://www.spigotmc.org/wiki/spigot-plugin-development/) 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | # WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP - WIP 538 | *** 539 | *(Work in progress)* 540 | 541 | **BASICS WITH HELLO WORLD** 542 | 543 | First of all, I will give you a simple overview of how a Java program looks like. 544 | In the below code, I have created a class – MyFirstJavaProgram and printed “Hello World”. 545 | Go ahead and try to execute the below example in your Eclipse IDE. Do not worry, we will discuss about Java class in a while. 546 | ``` 547 | public class MyFirstJavaProgram { 548 | public static void main(String[] args) 549 | { 550 | System.out.println("Hello World"); 551 | } 552 | } 553 | ``` 554 | Next, let us understand different member variables in Java. 555 | 556 | **MEMBER VARIABLES** 557 | 558 | A member variable plays a major role in a class as it is used to store a data value. When we define a class, we can declare a member variable. These variables are members of a class. 559 | Member variables are further classified into three types: 560 | 561 | Local variable 562 | Instance variable 563 | Class/Static variable 564 | Let me discuss about each one of them: 565 | 566 | Local variable: These are the variables which are declared within the method of a class. Let’s understand this with a programmatic example: 567 | ``` 568 | public class Car { 569 | public void display(int m){ // Method 570 | int model=m; // Created a local variable model 571 | System.out.println("Model of the car is" +model); 572 | } 573 | ``` 574 | In the above code, my local variable is ‘model’ which I have declared inside a method ‘display’ which has a parameter ‘m’. 575 | 576 | Instance variable: Instance variable is declared in a class but outside a method, constructor or any block. Let’s understand this with a programmatic example. 577 | 578 | ``` 579 | public class Car { 580 | public String color; // Created an instance variable color 581 | 582 | Car(String c) 583 | { 584 | color=c; 585 | } 586 | 587 | public void display() { // Method 588 | System.out.println("color of the car is"+color); 589 | } 590 | 591 | public static void main(String args[]){ 592 | Car obj=new Car("black"); 593 | obj.display(); 594 | } 595 | } 596 | ``` 597 | In the above code, ‘color’ is my instance variable which has a value “black” associated to it. 598 | 599 | Class variable: Class variables are also called as static variables. These variables have only one copy that is shared by all the different objects in a class. Let’s understand this with a programmatic example. 600 | 601 | ``` 602 | public class Car { 603 | public static int tyres; // Created a class variable tyres 604 | public static void main(String args[]){ 605 | tyres=4; 606 | System.out.println("Number of tyres are"+tyres); 607 | } 608 | } 609 | ``` 610 | All cars must be having 4 tyres, right? So in my above code, I have declared a static variable as ‘tyre’ whose value remains same throughout the class. 611 | 612 | **DATA TYPES** 613 | 614 | A data type is used to represent different values which are stored in a variable. They are mainly classified into 4 different aspects – Integer, Float, Character and Boolean. You can refer to the below image to understand the different data types with respect to the memory allocated to them. 615 | 616 | ![primitive_data_type](https://user-images.githubusercontent.com/41565823/46495600-1f9cb700-c816-11e8-9a29-a961a3be48eb.png) 617 | 618 | As you can see in the above image, data types are of 4 major types. 619 | 620 | The first data type is an Integer which stores a numerical value.
621 | Now, if a numerical value contains decimal part, it will be referred as float.
622 | Next, if you wish to store a character, then the third data type i.e char is used. In char, you can store any alphabetical character as well as a special character.
623 | The last data type is Boolean which stores only ‘true’ or ‘false’ value.
624 | 625 | Let’s move forward and look at the various data operations which you can perform in Java. 626 | 627 | **DATA OPERATORS** 628 | 629 | There are mainly 4 different types of operators, which are listed below: 630 | 631 | Arithmetic Operator: Perform arithmetic operations such as addition, subtraction, multiplication, division and modulus. 632 | 633 | Unary Operator: Unary operators are used to increment or decrement a particular value. For example: ++ stands for increment, – – stands for decrement. 634 | 635 | Relational Operator: It defines some kind of relation between two entities. For example: <, >, <=, >=, !=, ==. 636 | 637 | Logical Operator: Logical operators are typically used with boolean (logical) values. 638 | 639 | **CONTROL STATEMENTS** 640 | 641 | Control statements are the statements that define the flow of your program. There are 3 types of control statements in Java: Selection, iteration and jump statements. 642 | 643 | ![control-statements](https://user-images.githubusercontent.com/41565823/46495877-db5de680-c816-11e8-9112-b42176bcbf04.png) 644 | 645 | Selection Statements: 646 | 647 | Selection statements allow you to control the flow of the program during run time on the basis of the outcome of an expression or state of a variable. For example: you want to eat pizza, but then where can you get that pizza in best price. You can select between various popular options like Domino’s, Pizza Hut or any other outlet. So here you are following a selection process from the various options available. 648 | 649 | Now these statements can be further classified into the following: 650 | 651 | If-else Statements 652 | Switch Statements 653 | 654 | Refer to the following flowchart to get a better understanding of if-else statements: 655 | 656 | ![ifelse-flowchart-365x300](https://user-images.githubusercontent.com/41565823/46495943-0ba58500-c817-11e8-8f9c-3222474c94fe.png) 657 | 658 | In this flowchart, the code will respond in the following way: 659 | 660 | First of all, it will enter the loop where it checks the condition. 661 | If the condition is true, the set of statements in ‘if’ part will be executed. 662 | If the condition is false, the set of statements in the ‘else’ part will be executed. 663 | Here you must have got an idea of how these if-else statements work. Now, how can we use these statements in Eclipse IDE? Let’s have a look at the code: 664 | 665 | ``` 666 | public class Compare { 667 | int a=10, 668 | int b=5; 669 | 670 | if(a>b) 671 | { // if condition 672 | System.out.println(" A is greater than B"); 673 | } 674 | else 675 | { // else condition 676 | System.out.println(" B is greater"); 677 | } 678 | } 679 | ``` 680 | In the above code, I have created a class Compare where I have compared two numbers ‘a’ and ‘b’. First of all, it will go in ‘if’ condition where it checks whether the value of ‘a’ is greater than ‘b’ or not. If the condition is true, it will print “A is greater than B” else it will execute “B is greater”. 681 | 682 | Moving on, we have Switch case statement. The switch statement defines multiple paths for execution of a set of statements. It is a better alternative than using a large set of if-else statements as it is a multi-way branch statement. 683 | 684 | Refer to the following flowchart to get a better understanding of switch statements: 685 | 686 | ![switchstatement-java-271x300](https://user-images.githubusercontent.com/41565823/46496005-32fc5200-c817-11e8-81c2-5c0640f11103.png) 687 | 688 | In this Switch case flowchart, the code will respond in the following steps: 689 | 690 | First of all it will enter the switch case which has an expression. 691 | Next it will go to Case 1 condition, checks the value passed to the condition. If it is true, Statement block will execute. After that, it will break from that switch case. 692 | In case it is false, then it will switch to the next case. If Case 2 condition is true, it will execute the statement and break from that case, else it will again jump to the next case. 693 | Now let’s say you have not specified any case or there is some wrong input from the user, then it will go to the default case where it will print your default statement. 694 | Again, if we look at the code for switch statements in IDE, here it is: 695 | 696 | ``` 697 | public class SwitchExample { 698 | int week=7; 699 | String weeknumber; 700 | 701 | switch(week){ // switch case 702 | case 1: 703 | weeknumber="Monday"; 704 | break; 705 | 706 | case2: 707 | weeknumber="tuesday"; 708 | break; 709 | 710 | case3: 711 | weeknumber="wednesday"; 712 | break; 713 | 714 | default: // default case 715 | weeknumber="invalid week"; 716 | break; 717 | } 718 | System.out.println(weeknumber); 719 | } 720 | } 721 | ``` 722 | In the above code, I have created a class SwitchExample which has 3 cases that print days of a week. It also has a default case which is executed whenever a user doesn’t specify a case. 723 | 724 | Concluding both of the selection statements, we understood that if we are comparing two statements, we are using if-else, but let’s say if you are checking a specific value against a particular statement, then we are going for the Switch statement. 725 | 726 | Next, there is another set of control statements, i.e Iteration Statements. 727 | 728 | Iteration Statements: In Java, these statements are commonly called as loops, as they are used to iterate through small pieces of code. Iteration statements provide the following types of loop to handle looping requirements. 729 | -------------------------------------------------------------------------------- /object-oriented-programming/Java.md: -------------------------------------------------------------------------------- 1 | # Java 2 | Links and FAQ about java. 3 | 4 | ## Table of contents 5 | 1. [Free Java Courses](free-java-courses) 6 | 1. [Codecademy](codecademy) 7 | 2. [thenewboston](thenewboston) 8 | 9 | ## Free Java Courses 10 | 11 | ### Codecademy 12 | Codecademy is a website that teaches you to code in an interactive way (for free!) 13 | 14 | * [codecademy](https://www.codecademy.com/learn/learn-java) 15 | 16 | ### thenewboston 17 | thenewboston is a youtube channel that has many great programming and science-related tutorials 18 | 19 | * [thenewboston - beginner](https://m.youtube.com/playlist?list=PLFE2CE09D83EE3E28) 20 | 21 | * [thenewboston - intermediate](https://m.youtube.com/playlist?list=PL27BCE863B6A864E3) 22 | 23 | * [thenewboston - java game development](https://m.youtube.com/playlist?list=PLA331A6709F40B79D) 24 | -------------------------------------------------------------------------------- /object-oriented-programming/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CSEdelft/FAQ/e2e518e233caa2a9a35f4989e2641d0c2903698e/object-oriented-programming/README.md -------------------------------------------------------------------------------- /reasoning-and-logic/README.md: -------------------------------------------------------------------------------- 1 | # Reasoning and Logic 2 | FAQ For Reasoning and Logic 3 | ## Table of contents 4 | 1. [Disjunctive Normal Form](disjunctive-normal-form) 5 | 2. [De Morgan's Law](de-morgans-law) 6 | 3. [Arguments](arguments) 7 | 8 | ## Disjunctive Normal Form 9 | Disjunctive Normal Form or DNF for short is the disjunction of conjunctions of literals. Every formula has an equivalent in DNF. 10 | 11 | ### Examples of DNF 12 | ``` 13 | A 14 | 15 | A ∨ ¬A 16 | 17 | A ∨ (B ∧ ¬C) ∨ D 18 | ``` 19 | 20 | ### Transformation Algorithm 21 | There are several different methods for transforming an arbitrary formula into DNF. The following is one of the simplest with three steps: 22 | 23 | 1. Eliminate the connectives for implication (⇒) and equivalence (⇔) by rewriting using the following equivalences: 24 | * A ⇒ B is equivalent to ¬A ∨ B 25 | * A ⇔ B is equivalent to (¬A ∨ B) ∧ (A ∨ ¬B) 26 | 2. Push negations (¬) inside subformulas as far as possible, applying [De Morgan's Law](de-morgans-law) where possible, and eliminate double negations. We also handle the negation of the propositional constants. We do this by rewriting with the following equivalences: 27 | * ¬(¬A) is equivalent to A 28 | * ¬(A ∧ B) is equivalent to ¬A ∨ ¬B 29 | * ¬(A ∨ B) is equivalent to ¬A ∧ ¬B 30 | * ¬t is equivalent to f 31 | * ¬f is equivalent to t 32 | 3. Distribute conjunctions (∧) over disjunctions (∨). We rewrite all applicable subterms of the formula using one of the following two equivalences: 33 | * A ∧ (B ∨ C) is equivalent to (A ∧ B) ∨ (A ∧ C) 34 | * (A ∨ B) ∧ C is equivalent to (A ∧ C) ∨ (B ∧ C) 35 | 36 | ## De Morgan's law 37 | De Morgan's law states the following equivalences: 38 | * ¬(A ∧ B) ⇔ ¬A ∨ ¬B 39 | * ¬(A ∨ B) ⇔ ¬A ∧ ¬B 40 | 41 | ## Arguments 42 | An argument consists of a conclusion and a number of premesis. There can be one, more then one or even zero premesis in an argument. 43 | 44 | An argument is valid if and only if the conclusion is true for all cases (i.e. rows in the truth table) where all propositions are true. For propositional logic it is relatively easy to prove that an argument is valid. You draw out the truth table. You look at the conclusion. If and only if the conclusion is true, you look at the colomn of all the premesis. All premesis have to be true. If this isn't the case, the argument is invalid. Repeat this process for all rows where the conclusion is true. 45 | 46 | For predicate logic, this process is more difficult. You need to use a mathematical proof. I can't explain all mathematical proofs here, because they are different for every argument. Look at the text book, that explains it pretty well. 47 | 48 | ### Special cases 49 | 50 | If an argument has no premesis, the conclusion must be a tautology (i.e. always true) for the argument to be valid. A example of a tautology is (p or not p). 51 | 52 | Principal of explosion: if one of the premesis is a contradiction (i.e. always false), the argument is always valid. Look at the definition of a valid argument. The conclusion has to be true for all cases where all propositions are true. If there are no cases where the propositions are true, this definition technically holds. It won't win you a debate, but the argument is logically valid. 53 | 54 | ## Sources 55 | * Hugtenburg, S. & Yorke-Smith, N. (2018) Delftse Foundations of Computation. Available for download [here](https://textbooks.open.tudelft.nl/index.php/textbooks/catalog/book/13) 56 | * [DNF](http://www.barrywatson.se/cl/cl_dnf.html) 57 | 58 | 59 | ## Useful Links 60 | * [Logical Equivalence](https://en.wikipedia.org/wiki/Logical_equivalence) 61 | * [Recursion](https://en.wikipedia.org/wiki/Recursion#In_mathematics) 62 | -------------------------------------------------------------------------------- /web-and-database-technology/Demo1.md: -------------------------------------------------------------------------------- 1 | ``` 2 | 3 | jonathan@DESKTOP-B1K4GDE:~$ telnet microsoft.com 80 4 | Trying 40.76.4.15... 5 | Connected to microsoft.com. 6 | Escape character is '^]'. 7 | HEAD / HTTP/1.1 8 | host:microsoft.com 9 | 10 | HTTP/1.1 301 Moved Permanently 11 | Date: Mon, 12 Nov 2018 11:22:47 GMT 12 | Server: Kestrel 13 | Location: https://www.microsoft.com/ 14 | 15 | HEAD / HTTP/1.1 16 | host:www.microsoft.com 17 | 18 | HTTP/1.1 404 Not Found 19 | Date: Mon, 12 Nov 2018 11:23:18 GMT 20 | Server: Kestrel 21 | 22 | ^] 23 | 24 | telnet> ^C^Z 25 | [1]+ Stopped telnet microsoft.com 80 26 | jonathan@DESKTOP-B1K4GDE:~$ telnet www.microsoft.com 80 27 | Trying 2.20.27.153... 28 | Connected to e13678.dspb.akamaiedge.net. 29 | Escape character is '^]'. 30 | HEAD / HTTP/1.1 31 | host:www.microsoft.com 32 | 33 | HTTP/1.1 200 OK 34 | Server: Apache 35 | ETag: "6082151bd56ea922e1357f5896a90d0a:1425454794" 36 | Last-Modified: Wed, 04 Mar 2015 07:39:54 GMT 37 | Accept-Ranges: bytes 38 | Content-Length: 1020 39 | Content-Type: text/html 40 | Date: Mon, 12 Nov 2018 11:24:11 GMT 41 | Connection: keep-alive 42 | 43 | GET / HTTP/1.1 44 | host:www.microsoft.com 45 | 46 | HTTP/1.1 200 OK 47 | Server: Apache 48 | ETag: "6082151bd56ea922e1357f5896a90d0a:1425454794" 49 | Last-Modified: Wed, 04 Mar 2015 07:39:54 GMT 50 | Accept-Ranges: bytes 51 | Content-Length: 1020 52 | Content-Type: text/html 53 | Date: Mon, 12 Nov 2018 11:24:28 GMT 54 | Connection: keep-alive 55 | 56 | Microsoft Corporation

Your current User-Agent string appears to be from an automated process, if this is incorrect, please click this link:United States English Microsoft Homepage

57 | 58 | ``` 59 | -------------------------------------------------------------------------------- /web-and-database-technology/README.md: -------------------------------------------------------------------------------- 1 | # Web & Database Technology 2 | 3 | FAQ For Web & Database Technology 4 | 5 | ## Content 6 | 7 | This course is split into two parts. [web](./web.md) and [database](./database.md). 8 | Check them out to learn more about that section. 9 | 10 | ## Usefull links 11 | 12 | | Link | Type | Description | 13 | | --------------------------------------------------------------- | ---- | ---------------------------------- | 14 | | [You Don't Know JS](https://github.com/getify/You-Dont-Know-JS) | Book | A free introduction to JavaScript. | 15 | -------------------------------------------------------------------------------- /web-and-database-technology/database.md: -------------------------------------------------------------------------------- 1 | # Database 2 | 3 | This document contains information about the database lectures. 4 | 5 | This should be filled with information, 6 | But it is not right now. 7 | You can submit a PR to fix this! 8 | -------------------------------------------------------------------------------- /web-and-database-technology/web.md: -------------------------------------------------------------------------------- 1 | # Web 2 | 3 | This page contains information about the web part of the course. 4 | 5 | This should be filled with information, 6 | But it is not right now. 7 | You can submit a PR to fix this! 8 | 9 | 10 | ## lecture 1: 11 | 12 | * 20% lab 13 | * 40% web 14 | * 40% database 15 | 16 | 17 | ### organisations: 18 | 19 | W3C --> negotiator between browsers so implementations are standardised between browsers 20 | IETF --> Request for Comment 21 | 22 | ### HTTP 23 | 24 | #### HTTP/1.1, RFC 2086 25 | 26 | more support 27 | 28 | server waits 29 | client initiates conversation (request) 30 | server handles requests (response) 31 | 32 | 33 | 34 | #### HTTP/2, RFC 7540 35 | 36 | less support 37 | 38 | 39 | #### Content type 40 | MIME: 41 | 42 | pattern: 43 | [primary object type]/[subtype] 44 | examples: 45 | 46 | * text/plain 47 | * text/html 48 | * image/jpg 49 | * unknown/unknown 50 | * application/xml 51 | * model/mesh 52 | 53 | #### Content length 54 | 55 | if size of body doesnt match header length --> reject 56 | 57 | also important for persistent connections. if multiple http requests are sent this field can help the browser 58 | find the end of the stream of requests 59 | 60 | #### Content encoding 61 | 62 | tells what kind of compression the server or client understands and thus can send to eachother. 63 | 64 | advantage: less bandwidth 65 | disadvantage: more cpu time 66 | 67 | examples: 68 | 69 | * gzip 70 | * deflate 71 | * identity 72 | 73 | #### Content MD5 74 | 75 | removed in HTTP 2.0 though it's still used. 76 | used to verify content. 77 | 78 | md5 is a hash computed of the entire body. if a bit is changed the md5 is different. so if the client recalculates md5 and it doesnt match the server knows there is something wrong 79 | 80 | #### Expires 81 | 82 | lets the client know when the content is not valid anymore and the client has to re-request it. this however has in history rarely actually been used by clients and is mostly used by webcaches. when a webcache has a recource, and it is not expired it will serve it, else it is forwarded to the origin server (Eventually, it might go through multiple webcaches) 83 | 84 | web browsers also cache webpages. Therefore nowadays the expires field is more useful for clients too. 85 | 86 | #### Last modified 87 | 88 | again mostly used by webcaches to know when it has to re-request data to cache. used to be used by search engines to give higher rankings to recently modified pages. due to abuse searchengines dont do this anymore. 89 | 90 | #### Connection & Upgrade 91 | 92 | Used so the server can push to clients (instead of client initiating requests) 93 | 94 | simulating server --> client requests: 95 | * polling 96 | * long polling (server keeps conenction open until new data arrived) 97 | 98 | HTTP/1.1 doesnt allow more than this 99 | 100 | ##### Websocket protocol: 101 | 102 | enables bidirectional communcation between client and server 103 | 104 | 105 | 106 | client initiates bidirectional communication 107 | client sends 2 headers: 108 | 109 | if server allows connection upgrade to websockets 110 | then bidirectional communication is established 111 | 112 | 113 | 114 | 115 | #### Status code 116 | 117 | 1xx 118 | informational 119 | 120 | 2xx 121 | request ok 122 | 123 | 3xx 124 | redirected, resource moved 125 | 126 | 4xx 127 | client error 128 | 404 resource not found 129 | 130 | 402: reserved for *payment requred* 131 | 132 | 5xx 133 | server error 134 | should never be seen. server errors shouldnt be seen by clients! 135 | 136 | 137 | 138 | ### HTTP Methods 139 | 140 | GET 141 | sends resource, header and body 142 | 143 | HEAD 144 | only send the header, no body 145 | 146 | POST 147 | WIP 148 | 149 | PUT 150 | WIP 151 | 152 | TRACE 153 | WIP 154 | 155 | OPTIONS 156 | WIP 157 | 158 | DELETE 159 | WIP 160 | 161 | ### IP addresses 162 | 163 | DNS server converts domain name to ip address 164 | 165 | ipv4: 166 | 167 | xx.xx.xx.xx (hex numbers) 168 | max 2^32 ip adresses 169 | push to convert to ipv6 170 | 171 | ipv6: 172 | 173 | xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx (hex numbers) 174 | 2^128 possibilities 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | --------------------------------------------------------------------------------