From 2830b5fb96cce787ca8c7562a968effc3e57bdb1 Mon Sep 17 00:00:00 2001 From: Silvino Date: Wed, 26 Jun 2019 16:58:13 +0100 Subject: dev index re-organization --- dev/c/basic.html | 59 ++++++++++++++++ dev/c/datatypes.html | 17 +++-- dev/c/hello.html | 134 +++++++++++++++++++++++++++++++++++ dev/c/index.html | 72 +++++++++++++++++++ dev/c/lib.html | 8 +-- dev/c/src/basic/AUTHORS | 1 + dev/c/src/basic/ChangeLog | 0 dev/c/src/basic/Makefile | 7 ++ dev/c/src/basic/NEWS | 0 dev/c/src/basic/README | 0 dev/c/src/basic/basic.c | 3 + dev/c/src/basic/basic.h | 27 +++++++ dev/c/src/hello/Makefile | 7 ++ dev/c/src/hello/hello.c | 6 ++ dev/index.html | 175 +++++----------------------------------------- dev/js/index.html | 18 +++-- dev/perl/index.html | 16 ++++- dev/php/hello.html | 83 ++++++++++++++++++++++ dev/php/index.html | 98 +++++++------------------- dev/python/hello.html | 18 +++++ dev/python/index.html | 30 +++----- dev/shell/index.html | 34 +++++++++ 22 files changed, 542 insertions(+), 271 deletions(-) create mode 100644 dev/c/basic.html create mode 100644 dev/c/hello.html create mode 100644 dev/c/src/basic/AUTHORS create mode 100644 dev/c/src/basic/ChangeLog create mode 100644 dev/c/src/basic/Makefile create mode 100644 dev/c/src/basic/NEWS create mode 100644 dev/c/src/basic/README create mode 100644 dev/c/src/basic/basic.c create mode 100644 dev/c/src/basic/basic.h create mode 100644 dev/c/src/hello/Makefile create mode 100644 dev/c/src/hello/hello.c create mode 100644 dev/php/hello.html create mode 100644 dev/python/hello.html create mode 100644 dev/shell/index.html (limited to 'dev') diff --git a/dev/c/basic.html b/dev/c/basic.html new file mode 100644 index 0000000..104e59a --- /dev/null +++ b/dev/c/basic.html @@ -0,0 +1,59 @@ + + + + + C - Basic + + + C & GDB Index + +

C - Basic

+ +

Multiple Sources

+ +

To organize code in multiple files split above + example in main.c, hello.c and hello.h. Content of + main.c;

+ +

+	#include "hello.h"
+
+	int main() {
+	    hello("world");
+	    return 0;
+	}
+	
+ +

Header file contains declaration of the function hello, + content of hello.h;

+ +
+	void hello(const char* name);
+	
+ +

Implementation of hello function in hello.c;

+ +
+	#include <stdio.h>
+	#include "hello.h"
+
+	void hello(const char* name) {
+	    printf("Hello, %s!\n", name);
+	}
+	
+ +

Compile;

+ +
+	$ gcc -Wall main.c hello.c -o hello
+	
+ + C & GDB Index +

+ This is part of the Hive System Documentation. + Copyright (C) 2019 + Hive Team. + See the file Gnu Free Documentation License + for copying conditions.

+ + diff --git a/dev/c/datatypes.html b/dev/c/datatypes.html index cbe19a2..77b5dbb 100644 --- a/dev/c/datatypes.html +++ b/dev/c/datatypes.html @@ -13,22 +13,27 @@
char
-
Integer, one byte.
+
Integer is 1 byte.
+
int
-
Integer.
+
Integer numbers 4 bytes (short is 2 bytes and long is 4 bytes)
+
float
-
Single precision floating point.
+
Single precision floating point is 4 bytes.
+
double
-
Double precision floating point.
+
Double precision floating point is 8 bytes.
+
void
Absence of type.
-

Data types

Integer

+

Allowed types are char and int;

+
signed char
8 bit, from -128 to 127.
@@ -93,7 +98,7 @@
         struct point {
-            int x, y;
+            int x, y, z;
         } first_point;
         struct point second_point;
         
diff --git a/dev/c/hello.html b/dev/c/hello.html new file mode 100644 index 0000000..ff31bc9 --- /dev/null +++ b/dev/c/hello.html @@ -0,0 +1,134 @@ + + + + + C & GDB + + + C & GDB Index + +

Hello World

+ +

C "allows to implement" or approach to various + programming paradigms but due to it's characteristics + it's more a procedural language. C procedural programs + are divided in smaller procedures, or functions, and + data or pointers to data are passed into them or is + shared between them. To get started create file + hello.c with;

+ +
+	#include <stdio.h>
+
+	int main() {
+	    printf("Hello World!");
+	    return 0;
+	}
+	
+ +

Compile;

+ +
+	$ gcc -Wall hello.c -o hello
+	
+ +

Run;

+ +
+	$./hello
+	Hello World!
+	
+ +

Makefile

+ +

Make reads a Makefile by default on current directory, + Makefile defines targets, for example executables and their + dependencies, for example object files and source files.

+ +

Create Makefile;

+ +
+	CC=gcc
+	CFLAGS=-Wall
+
+	hello: main.o hello.o
+
+	clean:
+		rm -f hello main.o hello.o
+	
+ +
+	$ touch NEWS README AUTHORS ChangeLog
+	
+ +

Debug

+ +

To use gdb you need to compile program with -g flag. Change + Makefile

+ +
+	CC=gcc
+	CFLAGS=-Wall -g
+
+	hello: main.o hello.o
+
+	clean:
+		rm -f hello main.o hello.o
+	
+ +
+	$ gdb hello
+	
+ +

Set break point;

+ +
+	(gdb) break main
+	
+ +

To start the program you can type run, this way gdb + will try to run the program until the end. If program + crash, gdb will stop it for debuging. Start program;

+ +
+	(gdb) run
+	
+ +

Step in next line;

+ +
+	(gdb) s
+	
+ +

Print variable "name" value;

+ +
+        (gdb) print name
+        $1 = 0x4005b0 "world"
+        (gdb)
+        
+ +

Print variable "name" type;

+ +
+        (gdb) ptype name
+        type = const char *
+        (gdb)
+        
+ +

Variable is a string constant. + Execute next line to end;

+ +
+	(gdb) n
+	
+ + C & GDB Index +

+ This is part of the Hive System Documentation. + Copyright (C) 2019 + Hive Team. + See the file Gnu Free Documentation License + for copying conditions.

+ + diff --git a/dev/c/index.html b/dev/c/index.html index 2f0c068..3c48776 100644 --- a/dev/c/index.html +++ b/dev/c/index.html @@ -7,6 +7,78 @@ Development Index +

C & GDB

+ + + + + +

C & GDB

Hello World

diff --git a/dev/c/lib.html b/dev/c/lib.html index 4b6c07e..4531d7a 100644 --- a/dev/c/lib.html +++ b/dev/c/lib.html @@ -5,7 +5,7 @@ Libraries - Development Index + C & GDB Index

Libraries

@@ -13,12 +13,12 @@

Basic

-
include <unistd.h>
+
@include <unistd.h>
fork, pipe and I/O primitives (read, write, close, etc.) + primitve types like uid_t, pid_t etc
#include <stdlib.h>
-
Standard lib, contains primitves for number conversion +
Standard lib, contains primitives for number conversion and memory allocation
#include <stdio.h>
Basic i/o lib: printf etc
@@ -243,7 +243,7 @@ void pthread_exit(void *value_ptr); - Development Index + C & GDB Index

This is part of the Hive System Documentation. diff --git a/dev/c/src/basic/AUTHORS b/dev/c/src/basic/AUTHORS new file mode 100644 index 0000000..dcfefd1 --- /dev/null +++ b/dev/c/src/basic/AUTHORS @@ -0,0 +1 @@ +Silvino Silva, silvino at bk dot ru diff --git a/dev/c/src/basic/ChangeLog b/dev/c/src/basic/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/dev/c/src/basic/Makefile b/dev/c/src/basic/Makefile new file mode 100644 index 0000000..f165c15 --- /dev/null +++ b/dev/c/src/basic/Makefile @@ -0,0 +1,7 @@ +CC=gcc +CFLAGS=-Wall + +basic-c: main.o basic.o + +clean: + rm -f *.o basic-c diff --git a/dev/c/src/basic/NEWS b/dev/c/src/basic/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/dev/c/src/basic/README b/dev/c/src/basic/README new file mode 100644 index 0000000..e69de29 diff --git a/dev/c/src/basic/basic.c b/dev/c/src/basic/basic.c new file mode 100644 index 0000000..744b739 --- /dev/null +++ b/dev/c/src/basic/basic.c @@ -0,0 +1,3 @@ +#include "basic.h" + + diff --git a/dev/c/src/basic/basic.h b/dev/c/src/basic/basic.h new file mode 100644 index 0000000..6eef13f --- /dev/null +++ b/dev/c/src/basic/basic.h @@ -0,0 +1,27 @@ +enum operations{deposit, redraw} + +union u_account { + int id; + int value; + char *client_name; + int *log_head; + union u_account *next; +} + +struct s_accounts { + int total_accounts; + int total_value; + union u_account *head_account; +} + +struct s_operation { + int time, amount; + enum operations op; + struct s_operation *next; +} + +struct s_log { + int number; + struct s_operation *operation; + struct s_log *next; +} diff --git a/dev/c/src/hello/Makefile b/dev/c/src/hello/Makefile new file mode 100644 index 0000000..a6d9f07 --- /dev/null +++ b/dev/c/src/hello/Makefile @@ -0,0 +1,7 @@ +CC=gcc +CFLAGS=-Wall + +hello: hello.o + +clean: + rm -f *.o hello diff --git a/dev/c/src/hello/hello.c b/dev/c/src/hello/hello.c new file mode 100644 index 0000000..df66493 --- /dev/null +++ b/dev/c/src/hello/hello.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("hello World!"); + return 0; +} diff --git a/dev/index.html b/dev/index.html index 576cada..5c55583 100644 --- a/dev/index.html +++ b/dev/index.html @@ -11,171 +11,28 @@

Tools for development and debugging

-

Git

+
+
Git
+
Git is a distributed version control system, for example this document is meant to be distributed using git.
+
C & GDB
+
C is compiled language created by Dennis Ritchie. BSD, Linux and Minix kernels use this language as primary language.
-

Git is a distributed version control system, for example this document is meant to be distributed using git.

- +
Python is an interpreted, interactive, object-oriented programming language.
+
Perl
+
Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" usually refers to Perl 5, but it may also refer to its redesigned "sister language", Perl 6.
-

C & GDB

+
JavaScript
+
JavaScript is a high-level, interpreted programming language that conforms to the ECMAScript specification. JavaScript has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions.
-

C is functional compiled language created by Dennis Ritchie. BSD, Linux and Minix kernels use this language - as primary language.

- - - - - -

Shell Script

- -

Script files that start with "#!/bin/sh" use dash (in crux), - /bin/sh is a link to dash, while files that start with "#!/bin/bash" - use bash;

- - - -

Python

- - -

Perl

- - - -

JavaScript

- - -

PHP

- - - +
PHP
+
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
+
Documentation Index

This is part of the Hive System Documentation. diff --git a/dev/js/index.html b/dev/js/index.html index 66c0be1..ad746fd 100644 --- a/dev/js/index.html +++ b/dev/js/index.html @@ -2,23 +2,27 @@ - c9 JavaScript + JavaScript Development Index -

c9 JavaScript

+

JavaScript

+ Development Index

This is part of the Hive System Documentation. - Copyright (C) 2018 + Copyright (C) 2019 Hive Team. See the file Gnu Free Documentation License for copying conditions.

- - - - diff --git a/dev/perl/index.html b/dev/perl/index.html index dbef1e1..9fe7ad3 100644 --- a/dev/perl/index.html +++ b/dev/perl/index.html @@ -2,17 +2,27 @@ - c9 Perl + Perl Development Index -

c9 Perl

+

Perl

+ + + Development Index

This is part of the Hive System Documentation. - Copyright (C) 2018 + Copyright (C) 2019 Hive Team. See the file Gnu Free Documentation License for copying conditions.

diff --git a/dev/php/hello.html b/dev/php/hello.html new file mode 100644 index 0000000..cc0f82a --- /dev/null +++ b/dev/php/hello.html @@ -0,0 +1,83 @@ + + + + + PHP - Hello + + + PHP Index + +

Hello World

+ +

PHP comes with a built in server that helps to speed up + developing by not having to configure a system web server, + first create file index.php;

+ +
+        <?php
+           echo "Hello World";
+        
+ +

Now run the server;

+ +
+        $ php -S localhost:8000
+        
+ +

Open your browser and browse http://localhost:8000, + you should see "Hello World".

+ +

Profiling

+ +

Testing

+ +

Create folder tests for phpunit files with settings, inside + create another called tests to create tests to be performed on + the code.

+ +
+        $ mkdir -p tests/tests
+        $ cd tests
+        
+ +

Create a test tests/EngineTest.php;

+ +
+       <?php
+        declare(strict_types=1);
+
+        use PHPUnit\Framework\TestCase;
+
+        final class EngineTest extends TestCase {
+
+            public function testCanBeCreated(){
+
+                   $engine = new engine();
+
+                   $this->assertInstanceOf(engine::class, $engine);
+
+            }
+        }
+       
+ +

Create phpunit.xml;

+ +
+       $ phpunit --generate-configuration
+       
+ +

Run the test;

+ +
+       $ phpunit
+       
+ + PHP Index +

+ This is part of the Hive System Documentation. + Copyright (C) 2018 + Hive Team. + See the file Gnu Free Documentation License + for copying conditions.

+ + diff --git a/dev/php/index.html b/dev/php/index.html index fdb2b09..fb25bcf 100644 --- a/dev/php/index.html +++ b/dev/php/index.html @@ -2,89 +2,41 @@ - c9 PHP + PHP Development Index -

c9 PHP

- - -

Hello World

- -

PHP comes with a built in server that helps to speed up - developing by not having to configure a system web server, - first create file index.php;

- -
-        <?php
-           echo "Hello World";
-        
- -

Now run the server;

- -
-        $ php -S localhost:8000
-        
- -

Open your browser and browse http://localhost:8000, - you should see "Hello World".

- -

Profiling

- -

Testing

- -

Create folder tests for phpunit files with settings, inside - create another called tests to create tests to be performed on - the code.

- -
-        $ mkdir -p tests/tests
-        $ cd tests
-        
- -

Create a test tests/EngineTest.php;

- -
-       <?php
-        declare(strict_types=1);
-
-        use PHPUnit\Framework\TestCase;
-
-        final class EngineTest extends TestCase {
-
-            public function testCanBeCreated(){
-
-                   $engine = new engine();
-
-                   $this->assertInstanceOf(engine::class, $engine);
-
-            }
-        }
-       
- -

Create phpunit.xml;

- -
-       $ phpunit --generate-configuration
-       
- -

Run the test;

- -
-       $ phpunit
-       
+

PHP

+ + + + +
    + +
  • PHP Unit
  • +
Development Index

This is part of the Hive System Documentation. - Copyright (C) 2018 + Copyright (C) 2019 Hive Team. See the file Gnu Free Documentation License for copying conditions.

- - - - diff --git a/dev/python/hello.html b/dev/python/hello.html new file mode 100644 index 0000000..8636452 --- /dev/null +++ b/dev/python/hello.html @@ -0,0 +1,18 @@ +

c9 Python

+ +
+        test="/root/data"
+        dir= test + "/other"
+        print(dir)
+        
+ +

Debugging;

+ +
+        import pdb
+        pdb.set_trace()
+        
+ +

Run your program;

+ + diff --git a/dev/python/index.html b/dev/python/index.html index 814e3f2..687df20 100644 --- a/dev/python/index.html +++ b/dev/python/index.html @@ -2,37 +2,29 @@ - c9 Python + Python Development Index -

c9 Python

- -
-        test="/root/data"
-        dir= test + "/other"
-        print(dir)
-        
- -

Debugging;

- -
-        import pdb
-        pdb.set_trace()
-        
- -

Run your program;

+

Python

+ Development Index

This is part of the Hive System Documentation. - Copyright (C) 2018 + Copyright (C) 2019 Hive Team. See the file Gnu Free Documentation License for copying conditions.

- diff --git a/dev/shell/index.html b/dev/shell/index.html new file mode 100644 index 0000000..f41d691 --- /dev/null +++ b/dev/shell/index.html @@ -0,0 +1,34 @@ + + + + + Shell scripting + + + Development Index + +

Shell scripting

+ + + + Documentation Index +

+ This is part of the Hive System Documentation. + Copyright (C) 2019 + Hive Team. + See the file Gnu Free Documentation License + for copying conditions.

+ + + -- cgit 1.4.1-2-gfad0 From 21de4609ddf376d8130ed733aa1d155101a0c7da Mon Sep 17 00:00:00 2001 From: Silvino Date: Sat, 8 Jun 2019 01:53:50 +0100 Subject: dev git added reset to work doc --- dev/git/work.html | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'dev') diff --git a/dev/git/work.html b/dev/git/work.html index 7f97af5..3111eaf 100644 --- a/dev/git/work.html +++ b/dev/git/work.html @@ -82,6 +82,12 @@ gloga () { $ git rebase -i oldest_commit_to_rewrite +

Undo last commit;

+ +
+    $ git reset --soft HEAD~1
+    
+

2.2. Logs, diff commits

Create patch files to target branch/tag/ref;

-- cgit 1.4.1-2-gfad0