Draft page for editing later
This is an article about my graduation project, We worked in insufficient resources (money and time), No perfect work should be expected here.

Team


A post shared by Ammar Atef (@ammar.atef45) on

Idea

The idea is to build a CNC with servo motors instead of steppers, Servo CNC's can be better than stepper or vice versa depending on the many parameters, But the idea of the project is to test if we can control and model it from scratch.

Result

This playlist has 12 videos of tests we made to get some results, some are successful, and some aren't.


Book

You can download the book from here[link], I think everything is well described, You can always contact me for more explanation.
In this tutorial, we will use Android Studio to show notifications


We start by creating a new Android studio project
Choose the app name as NotificationApp, package name as com.tutorial.notification.ammar

Then you can copy and paste this xml to your layout


This code is a simple linear layout with two buttons, one for showing toast and the other for showing notification in the notification bar.

Now let's look at the java code
This code is simple too.
We are identifying the buttons with their id, then we are adding onClickListner to them.
The toast button just is easy, you are using Toast class, calling makeText method, passing to it the context, the string you want to show and the time of it to stay, there is two options for the time Toast.LENGTH_SHORT for short period and Toast.LENGTH_LONG for long periods

The other buttons makes a notification with a notification builder, Notification Builder takes a context, then you call setSmallIcon, setTitleText and setContentText to form the shape of the notification.
Last thing to do is adding intent to it, this must be pending intent, so you can just make an intent to pass it to a pending intent which you have to pass to the method setContentIntent.
The notification Builder is ready so we are making a reference to the notification manager then calling it to notify with our notification after it is built.

Good luck with coding.
Demos App [Link to be Added] have a show of some working Android examples Implemented with Android Studio (You can see This[Link] video to see how to download and install it)


This is List of lessons describing how to implement them
1. Showing notifications[Link]
2. Send update message[Link to be Added]
3. Master-Detail View[Link to be Added]
4. Master-Detail Header[Link to be Added]
5. Social media sharing[Link to be Added]
6. Admob Ads[Link to be Added]
7. Translation[Link to be Added]

Microprocessor is an IC which has only the CPU inside them i.e. only the processing powers such as Intel’s Pentium 1,2,3,4, core 2 duo, i3, i5 etc. These microprocessors don’t have RAM, ROM, and other peripheral on the chip. A system designer has to add them externally to make them functional. Application of microprocessor includes Desktop PC’s, Laptops, notepads etc.
But this is not the case with Microcontrollers. Microcontroller has a CPU, in addition with a fixed amount of RAM, ROM and other peripherals all embedded on a single chip. At times it is also termed as a mini computer or a computer on a single chip. Today different manufacturers produce microcontrollers with a wide range of features available in different versions. Some manufacturers are ATMEL, Microchip, TI, Freescale, Philips, Motorola etc. 
 
Microcontrollers are designed to perform specific tasks. Specific means applications where the relationship of input and output is defined. Depending on the input, some processing needs to be done and output is delivered. For example, keyboards, mouse, washing machine, digicam, pendrive, remote, microwave, cars, bikes, telephone, mobiles, watches, etc. Since the applications are very specific, they need small resources like RAM, ROM, I/O ports etc and hence can be embedded on a single chip. This in turn reduces the size and the cost.
If you finished lesson1 Here[link], You have the tools you need to start.
This lesson we will start coding.

Create Project

Open Eclipse, Then go to File>New>JavaProject

 You will find a window asking you for some information to create the project
Enter the project name, Edit the path if you need and press finish

Close the welcome screen if it is still there, here we are done.
You have two folders in the project folder
JRE System Library that contains all libraries needed (check the past lesson), anyway we are not going to touch this folder.
src is the folder contains all the code files we are going to create.
Let's go next.

Hello World

Right-click on the src folder, then choose New>Class
In the window appears you have to set the name of the package and the name of the class.
The package is a unique name identifies a group of classes, Interfaces(we will know that thing soon) and more.
Classes can easily treat with other classed in the same package, Packages can be treated as libraries later so think in as good friends now.
The class name must start with an upper case letter.
Because the program will start running from this class we will check the box of public static void main.
Let us discuss what was that and go on.

Basic Rules

In Java, each application has an entry point, or a starting point, which is a method called main.
If you are c/c++ programmer so you know the syntax, it's the same.
  • In Java, every line of code that can actually run needs to be inside a class.
  • Every line ends with(;) (semicolon) - Never forget it.
  • Anything outside the {} will not run unless we told the program to run it.
  • Any line starts with // will not be compiled or executed.
Don't be confused, we will run some code it's okay.

Hello World Runs

Inside the public static void main(string[] args){} write this line:
System.out.println("Hello World");
Press run (green small icon with white arrow) and see the console in the bottom prints what we wrote inside the "".

Main method

To run our program, the main method must be identical to this signature:
public static void main(string[] args)
public: anyone can access it
static: method can be run without creating an instance of the class containing the main method
void: method doesn't return any value
main: the name of the method.

Input and Output

System.out is used to produce an output (usually to the console), system.in is used to get input for the program.

Code of this tutorial

The code in this lesson is in tutorial001 folder.
All codes of tutorial should be available here[link]
If you want to learn more about git and github you can go there[link]
No need for that you can just download the code

See you next time.
I'm going to produce a serious of articles to give a clear and good introduction to java and android.
This is the first one of the Java for Android serious where we are going to know what is java and explore the tools we will need to learn it.

What is Java?

Cup of Java

The word java is a noun, In dictionary can be defined as Coffee, for example, "I'm dying for a cup of java".
But when we say JAVA we mean a general-purpose computer programming language designed to produce programs that will run on any computer system.

The JAVA Language

Like any programming language, the Java language has its own structure, syntax rules, and programming paradigm. The Java language's programming paradigm is based on the concept of OOP, which the language's features support.
The Java language is a C-language derivative, so its syntax rules look much like C's. For example, code blocks are modularized into methods and delimited by braces ({ and }), and variables are declared before they are used.
Structurally, the Java language starts with packages. A package is the Java language's namespace mechanism. Within packages are classes, and within classes are methods, variables, constants, and more.
You don't understand what that means? It's okay only C/C++ programmers can, That won't affect your understanding through the tutorials here or any other place.

The Java Compiler

When you program for the Java platform, you write source code in .java files and then compile them. The compiler checks your code against the language's syntax rules, then writes out bytecode in .class files. Bytecode is a set of instructions targeted to run on a Java virtual machine (JVM). In adding this level of abstraction, the Java compiler differs from other language compilers, which write out instructions suitable for the CPU chipset the program will run on.

The JVM

At runtime, the JVM reads and interprets .class files and executes the program's instructions on the native hardware platform for which the JVM was written. The JVM interprets the bytecode just as a CPU would interpret assembly-language instructions. The difference is that the JVM is a piece of software written specifically for a particular platform. The JVM is the heart of the Java language's "write once, run anywhere" principle. Your code can run on any chipset for which a suitable JVM implementation is available. JVMs are available for major platforms like Linux and Windows, and subsets of the Java language have been implemented in JVMs for mobile phones and hobbyist chips.

The JAVA Development Kit (JDK)

When you download a Java Development Kit (JDK), you get — in addition to the compiler and other tools — a complete class library of prebuilt utilities that help you accomplish most common application development tasks.


Enough Talking, We need Just to run it.
Okay Sorry, We are about to start now, Ready? I know you are excited.

Install JDK

We will show you how to install it for Windows, If you are using different Operating System things are different.
  1. Browse to Java SE Downloads and click the Java Platform (JDK) box to display the download page for the latest version of the JDK.
  2. Agree to the license terms.
  3. Choose Your OS (Windows in our case), Download and Install.
You can just follow this video


Install Eclipse

We have the tools java need it to run on our device, but we don't have the IDE (Integrated Development Environment) we need to write the code and use for debugging and optimising our programs.
Throw this tutorial we are going to use Eclipse but, You are free to use any other IDE if you want.
  1. Browse to the Eclipse IDE downloads page.
  2. Click Eclipse IDE for Java Developers.
  3. Under Download Links on the right side, choose your platform (the site might already have sniffed out your OS type).
  4. Click the mirror you want to download from; then, save the file to your hard drive.
  5. Extract the contents of the .zip file to a location on your hard drive that you'll be able to remember easily 
This video shows you how I did it



Setup Eclipse

The Eclipse IDE sits atop the JDK as a useful abstraction, but it still needs to access the JDK and its various tools. Before you can use Eclipse to write Java code, you must tell it where the JDK is located.
To set up your Eclipse development environment:

  1. Launch Eclipse by double-clicking eclipse.exe
  2. The Workspace Launcher opens, allowing you to choose a root folder for your Eclipse projects. Use a folder you can easily remember, such as C:\home\workspace.
  3. Close the Welcome to Eclipse window.
  4. Click Window > Preferences > Java > Installed JREs.
  5. Eclipse points to an installed JRE. You must use the JRE that you downloaded with the JDK. If Eclipse does not automatically detect the JDK you installed, click Add..., and in the next dialogue box, clickStandard VM and then click Next.
  6. Specify the JDK's home directory (such as C:\home\jdk1.8.0_60 on Windows), and then click Finish.
  7. Confirm that the JDK that you want to use is selected and click OK.

You also can see this small video

Okay now everything is ready, you need to explore the IDE? go and play with it a little.
Are you afraid you make something wrong? Don't be for two reasons:


  • You don't have to be very careful when you explore something, We learn from problems so go and make some problems and I'm sure you can solve them.
  • You can easily restore the view of the IDE by clicking Window > Perspective > Reset Perspective.
Next, we will make our first java project - get it here[link].
I usually Suggest my followers on social media accounts to learn some techniques to improve their code readability.

One day I found a lot of students think that git or any version control software is not useful, what a surprise for me!!

What is version control?

According to Wikipedia,
A component of software configuration management, version control, also known as revision control or source control, is the management of changes to documents, computer programs, large web sites, and other collections of information.

So normally version control is the process of keeping track of code changes along the time.

What is git?

According to Wikipedia,
Git (/ɡɪt/) is a version control system (VCS) that is used for software development and other version control tasks. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.

Okay, git is just a software and we can't judge it as anything more than this.

Why Github not just sharing with the cloud?

Let us make something clear here, I'm not saying that Github or any git hosting website is better than any other one.
So sharing using any cloud like Drive, Dropbox or 4shared ... etc.
You really have many many options here, I use Github and Bitbucket but, I don't recommend a specific one, use just what you want.
But, using git hosting website allows you to easily push and pop your edits immediately.
Using a cloud requires you to back your code, upload, download and much more overhead.

Using git software itself is the purpose, That gives you many benefits and power to track code changes and bugs sources, It's hard at the beginning but once you spend time with it, you have full control on your project code.

How to learn it?

You can go here [link] for reading introduction tutorial Or try this 3 weeks only free course produced by Udacity here [here]

Good luck