Web Technology Fundamentals

Hi, Today in this article of Web Technology Fundamentals, we going see some Web Technology that built in today in the Internet.

W3C (World Wide Web Consortium)
Is the main international standards organization for the World Wide Web.
I- Typical Browser Components
In any kind of Browser's Components there is :

1- Browser UI
This is the Browser User Interface where there is the Address Bar, Menu and other Graphical Components

2- Internet Engine
The component which responsible for Direct Communication.

3- Rendering Engine (Layout Engine)
This one of basic things which responsible of Transfer the HTML Code into layout.
- Gecko = Mozilla Firefox - Firefox OS - Thunderbird
- Khtml = KDE - Konqueror
- Presto = Opera 13 (No Longer Exist)
- Webkit = Safari - WebOS
- Blink = Chrome - Opera 14+ - Android

4- JavaScript Engine
Obviously this is the one who responsible for executing the JavaScript Code
- V8 Engine = Chrome
- Rhino / SpiderMonkey = Mozilla Firefox
- Nitro = Safari

5- Networking
 Here we find all components of protocols (HTTP,FTP,...)

6- Dara Storage
Here we store data of Internet and managing sessions.

II- Web Stack
A group of software that work in together to build in and process web sites

MAMP = Mac, Apache, MySQL, PHP
WAMP = Windows, Apache, MySQL, PHP
WISA  = Windows, IIS, MsSQL, .NET
MARS = MySQL, Apache, Ruby, Solaris
LAMP = Linux, Apache, MySQL, PHP

 III- CSS Preprocessors
Is to code CSS in advantage way, rather than a lot of lines, you write less and get more .
Example :

We have 3 type of CSS Preprocessor :
Sass (http://sass-lang.com/)
Less (http://lesscss.org/)
Styles (https://learnboost.github.io/stylus/)

work with SSH

Hello every one, in this article we going see and work with SSH in order to connect to a remote Server and secure a non secure TCP Connection.

 What's SSH ?
Secure Shell, or SSH, is a cryptographic (encrypted) network protocol to allow remote login and other network services to operate securely over an unsecured network.

Install SSH Server
To install SSH Server on Linux Machines:
Debian : $ apt-get install openssh-server
redhat  : $ yum install openssh-server

The Configuration file location will be : /etc/ssh/sshd_config
Authentication !
For remote login, you need the username and the password in order to access, Or a Key Pair .
$ ssh user@hostname
This command allow remote login using the username and the password.

Generate a key Pair
$ ssh-keygen -t rsa
1 - This will generate a key Pair using RSA Algorithm encryption.
2 - Enter  the file Path in which to save the key
3 - Enter the passphrase (empty for no passphrase)
Note : If you Enter the passphrase, you will then need to Enter it every time you want connect to the Server

Now you have 2 keys :
id_rsa        = Private key which store in you're desktop
id_rsa.pub = Public key which you need to send it to the remote server

$ scp ~/.ssh/id_rsa.pub user@host:/home/user/.ssh/authorized_keys

This command will copy the Public key into the Server inside ".ssh/authorized_keys".

$ ssh -i ~/.ssh/id_rsa user@host
This will connect to the Server using the Private Key.

SSH Config File to make a short cut
We going see how to Configure a file in order to minimise the commands.

Host <host-IP>
         User <username>
         HostName <Host-IP>
         IdentityFile ~/.ssh/id_rsa

Those tools allows you to secure transfer files from/to the SSH Server.

Create SSH Tunnel
This SSH Feature allows you to create a SSH Tunnel for others TCP Services, so with this way we will secure the data transfer from/to the Destination and the Source.

$ ssh -L 9000:localhost:3306 user@host -N
This command will open a local port 9000 which is a tunnel to the host on port 3306.
To close the tunnel, only thing you need to press "Ctrl+C".

KYX-5461AS 4-digit 7-segment LED display with Arduino

Hello everyone, today we going to see how to use KYX-5461AS 4-digit 7-segment LED display with Arduino the KYX-5461AS is a 4-digit 7-segment LED display . So we can use it in order to display 4 Digit Number .

Here’s the pinout for both of the arduino and the KYX-5461AS :

KYX-5461AS Description Arduino
1 Segment E 7
2 Segment D 8
3 Decimal point 9
4 Segment C 10
5 Segment G 11
6 Digit 4 12
7 Segment B 13
8 Digit 3 2
9 Digit 2 3
10 Segment F 4
11 Segment A 5
12 Digit 1 6

Here's the Segment labels :

Ok, now let's take a look for my circuit :

- 12 wires.
- KYX-5461AS
- Breadboard
- Arduin Uno
- 4 X ( 1K Resistor).

And let's jump in to my code :

And this is the video :

HC-06 Bluetooth in Ubuntu

Hi, in this article we going see how to connect HC-06 Bluetooth in Ubuntu.

So first thing we need to pair this device with ubuntu using the Bluetooth GUI in Ubuntu .

Select the device and make sure you set up the Pin Option to '1234'.

Then, Open Terminal and make sure that you can see the device !

$ hcitool scan

Now go head and edit this file :  "/etc/bluetooth/rfcomm.conf"

$ sudi gedit /etc/bluetooth/rfcomm.conf
uncomment and change it to :

rfcomm0 {
    # Automatically bind the device at startup
    bind no;

    # Bluetooth address of the device
    device 98:D3:31:80:51:48;

    # RFCOMM channel for the connection
    channel    1;

    # Description of the connection
    comment "HC-06";

Make sure you change the device to you're HC-06 Module Address !.

finally, bind the device with :
$ sudo rfcomm bind rfcomm0
 then use minicom to communicate with the modue in serial !

$ sudo minicom -D /dev/rfcomm0 -b 9600 -8

and don't forget to release the device when you finishing

$ sudo rfcomm release rfcomm0

Programming Arduino in pure C

In this article we will see how to stepping away from the Arduino IDE, and Programming Arduino in pure C Language.

Using C to programming Arduino means we are able to Create smaller programs. All the tools we going to use, Fortunately Arduino IDE use them but under the hood. So Arduino IDE use arv-gcc compiler and arvdude to upload.
The Arduino IDE preferences contains verbosity options, so we can see all the commands are been used.

From C code to Arduino board with avr-gcc
avr-gcc toolchain doesn’t know the Arduino Uno board layout, it only knows the microcontroller that is mounted on it, which is the Atmega328p, so we need to read/write directly the hardware I/O registers of that particular chip, and look at its pinout to understand the pin names and where they go: everything can be found in the Atmega328p datasheet. Instead from the Arduino Uno schematics we can find out where the pins are connected, for example we can find that the LED on Pin 13 of the arduino uno is connected to the PB5 pin of the Atmega328p chip.

The AVR compiler is complemented with a C library: avr-libc, which contains useful functions and headers to access the functionalities and I/Os of AVR chips. It also makes it easy to write complete C programs without using assembly language. Inside the Atmega328p datasheet there are many examples on how to toggle IOs, and with them I prepared the following code in a file called "led.c".

On Ubuntu Please Install the following tools :
$ sudo apt-get install gcc-avr
$ sudo apt-get install avrdude
$ sudo apt-get install avr-libc
The compiler avr-gcc is able to create an ELF executable program that contain machine code and other information such as program section memory layout and debug information.
The tool to convert the ELF into IHEX in our case is avr-objcopy. Now it’s time to run the command lines that build and upload the LED blink program using avrdude.
Most of the parameters and options of the avr-gcc and the avrdude tools for the Uno board can be found in the "hardware/arduino/avr/boards.txt" file from inside the Arduino IDE installation directory, and some other information is present in the avrdude manual.

$ avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o led.o led.c
$ avr-gcc -mmcu=atmega328p led.o -o led

$ avr-objcopy -O ihex -R .eeprom led led.hex
$ avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyUSB0 -b 115200 -U flash:w:led.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "led.hex"
avrdude: input file led.hex auto detected as Intel Hex
avrdude: writing flash (176 bytes):

Writing | ################################################## | 100% 0.04s

avrdude: 176 bytes of flash written

avrdude: safemode: Fuses OK (H:00, E:00, L:00)

avrdude done.  Thank you.

1) The first command avr-gcc takes the C source file and compiles it into an object file. The options tell the compilerto optimize for code size,what is the clock frequency (it’s useful for delay functions for example) and which is the processor for which to compile code.

2) The second commands avr-gcc links the object file together with system libraries (that are linked implicitly as needed) into an ELF program.

3) The third command avr-objcopy converts the ELF program into an IHEX file.

4) The fourth command avrdude uploads the IHEX data in to the Atmega chip embedded flash, and the options tells avrdude program to communicate using the Arduino serial protocol, through a particular serial port which is the Linux device "/dev/ttyUSB0", and to use 115200bps as the data rate.

After the commands are done the code is uploaded and the led starts blinking. That went well at the first try, mostly due to the fact that the tools have good support for the Arduino.

It is possible to list the ELF program in terms of assembly instructions (disassemble the program) by using this command:
 $ avr-objdump -d led >led.lst
 It is also possible to do a backup of the Atmega328p Flash content by using this command:
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyUSB0 -b 115200 -U flash:w:led.hex
This Article has been take from Freedom Embedded.

Basics of Programming Fundamentals

In this article we will see some of the Basics of Programming Fundamentals of different languages, So.

What's is the different language:
There are al lot of different type of Programming language depend on how they work, how strong they are, how they managing the memory and the type of them:

As you can see different type of language, Based from Strong they are to Communicate With CPU.
Low-Level Languages : (Assembly -> C) To
High-Level Languages : (C++ -> Objective-C -> Java, C#, VB.Net -> Ruby, Python -> JavaScript, ActionScript).

And based on how they work :
Compiled : C, C++, Objective-C
Interpreted : PHP, JavaScript, Python
Hybrid : Java, C#, VB.Net

And type they are :
Procedural : Pascal, C, Assembly,...
Oriented-Object : Java, Ruby, Python,...

And how they managing the Memory :
Manual : They are quite close to the machine code, if you work with (C, Assembly) you have to do a lot of work to free or allocate memory you're using !
Reference Counting : (C++, Objective-C ) Using The counting technique, when keep counter of who he use the object and free the object when the counting reach 0.
Garbage Collection : (Java, C#, VB.NET) Using this technique, the system will keep tracking how much memory you're application is using and in some point of the program life-time the system will scan through all you're object and figure out wish one are still unused and clear them, BUT this technique you don't know when will happen. bu you can call it !
Automatic : Scripting Language clear the memory automatic !

Some Programming Fundamentals Terms:

Pseudocode : is writing the program instructions in plain English, so normal people can understand !.

Multithreading : is like calling a function in the program but instead of jumping to it, we can create a threat .
A thread is a single sequence stream within in a process. Because threads have some of the properties of processes, they are sometimes called lightweight processes.
It's like two things happen in the same time (the main program and the threat).

Exploring The Languages :

C : Is for advanced and Strongly programming, is pure procedural language.

Java : Cross-Platform "Write once, run anywhere!", is object-oriented language. With hole library (Require JVM to run Applications)

VB.NET, C# : Is for Microsoft Platform (Require .NET Framework to run applications). Language for Desktop Apps, WebApps (ASP.NET) and Mobile Apps (Windows Phone).

Ruby : The purest Oriented-Object Language, cross-platform.

Python : Easy language, cross-platform, webapps .

Objective-C : It's C with Oriented-Object and Compiled Language, for Apple Platform



Oussama Amri 21 years, security professional from Tunisia. Lover of computer science especially programming and secuirty. Follow me On :

Popular Posts

iThePro.com. Powered by Blogger.