Sunday, 30 April 2017

Continue with the C++

Hi guys..
So, this time ,we will be continue about C++

In a control structure,there are  three essential structure which are:

1.Sequential
2.Selection
3.Repetition


Sequential


  • Carrying out statements in the order 
  • Default control structure unless the other control structures causes a change in the sequence

Selection
  • One of several alternatives will be chosen based on a condition 
  •  Execute the chosen alternative and skip the other alternative 

So for this  selection, there are if-statement,if -else statement and also switch statement. The example are shown as below:



The result will be like this. Then, you just have to enter the value , click the enter button and it will automatically determine the statement based on your code written just now.


 Make sure the condition before inserting the symbol,based on the statement given.


It is important to remind that,for an expression like this:

  n  100 

  we have to write them in this ways:

0<=n  &&  n<=100


Repetition

  • Repeats a section of code as long as a certain condition is true.
  •  3 types of loop statement: 
  1.  while statement 
  2.  for statement
  3. do-while statement
Example of program using ‘while’statement: 


Example of program using ‘for’statement:



So,here we can see how the ‘do-while’ statement is different to ‘while’statement. 



That's it..Playing with codes and symbols, its quite tough, but don't worry,you guys will get through it soon. All the best!!See ya..



Saturday, 22 April 2017

Now Journey to The C++

Welcome back buddies 😊😉😃 this week we had learn about C++ with Dr Azni, our beautiful lecturer. Hope so you guys will enjoy our post this week 😗


First ,  example of  " Simple C++ Program


Let us see what we learn 💓 

1. comment line

- 1st line is a comment line which describe the purpose of the program.

- Begin with a double slash (//)

- Ignored by compiler, only used to assist the reader of the program

2. #include <iostream>

- preprocessor directive

- begin with symbol #

- <iostream> is called library – header file name enclosed in bracket

- library is a collection of useful functions, operators and symbols that may be accessed by a program

- <iostream> library defines the names cin and cout the operators >> and <<

3. using namespace std;

- to give instruction to the compiler to use function in standard library.

- allows the program to access all the names that are grouped as the collective named std.

4. statement

- one or more lines of code ends with a semicolon ;

5.  int main ()

- main function of the program

- consist of one or more statement enclosed in curly bracket { }

6. Names and keyword

 Names:
- use to define constants and variables
- sensitive to upper and lower cases
- use underscore for two or more words
- can contain digit but cannot begin with digit

Keyword:
- several collection of letters cannot be use as names for constants or variables since they have been reserve for special purposes in the language as listed in Figure 1.1

                                 Figure 1.1: C++ Keywords (Appendix F Hanly 2002)

7. cout <<

- format: cout << “ ”;

- statement enclosed in qoutes (“ ”) display the message on the screen

- an interactive message which the program asking for data from the user as input data is called a           prompt

8. Insertion operators (<<)

- cout refers to the output stream of the associated in the program’s output device, typically the screen

- output stream is an output destination for a continous stream of characters

- the insertion operator (<<) inserts characters in an output stream

9. cin >>

- format: cin >> variable name;

- copy the value type by user –variable input

- the variable name has to be defined earlier

10. Extraction operators (>>)

- the program can also views the characters typed at the keyboard as a stream

- cin is the name of the input stream associated with the standard input device, typically the keyboard

- the extraction operator (>>) extracts one or more characters from the input stream for storage as a data value

11. endl;

- terminates a line of output and starts a new one

12. return 0;

- the final line of a program

- by returning (0) indicates that the program has ran norm

💗 All above have shown in the picture above 💗


This is the simple C++ that we learn

    Figure 2.1 The coding 


We also have done an exercise about C++ 

Here we are 😁

       Figure 3.1 The exercise 

Fuhh lastly this is the end... We struggle a lot when doing this exercise..😌😌

Wait for us next week 💕💕😍

Sunday, 16 April 2017

Our journey with Python continues! :p

Assalamualaikum, hope you're feeling well today :) thank you for stopping by!

Last class, which is on 11th of April, we've continued learning about Python with Dr. KB. This time we've learned about Repeating Actions with Loops.

An example task that we might want to repeat is printing each character in a word on a line of its own.
 
word = 'lead'

We can access a character in a string using its index. For example, we can get the first character of the word ‘lead’, by using word[0]. One way to print each character is to use four print statements:
 
print(word[0])
print(word[1])
print(word[2])
print(word[3])
 
l
e
a
d 
 
However, the above example is a bad approach. Here’s a better approach:

word = 'lead'
for char in word:
    print(char)

l
e
a
d
 
This is shorter—certainly shorter than something that prints every character in a hundred-letter string—and more robust as well:
 
word = 'oxygen'
for char in word:
    print(char)
 
o
x
y
g
e
n
 
The improved version uses a for loop to repeat an operation—in this case, printing—once for each thing in a sequence. The general form of a loop is:

for element in variable:
    do things with element

Using the oxygen example above, the loop might look like this:

loop_image

where each character (char) in the variable word is looped through and printed one character after another. The numbers in the diagram denote which loop cycle the character was printed in (1 being the first loop, and 6 being the final loop).

In the example above, the loop variable was given the name char as a mnemonic; it is short for ‘character’. ‘Char’ is not a keyword in Python that pulls the characters from words or strings. In fact when a similar loop is run over a list rather than a word, the output would be each member of that list printed in order, rather than the characters.
 
list = ['oxygen','nitrogen','argon']
for char in list:
   print(char)
 
oxygen
nitrogen
argon

We can choose any name we want for variables. We might just as easily have chosen the name banana for the loop variable, as long as we use the same name when we invoke the variable inside the loop:

word = 'oxygen'
for banana in word:
    print(banana)
 
o
x
y
g
e
n

It is a good idea to choose variable names that are meaningful so that it is easier to understand what the loop is doing.
Here’s another loop that repeatedly updates a variable:
 
length = 0
for vowel in 'aeiou':
    length = length + 1
print('There are', length, 'vowels')
 
There are 5 vowels

It’s worth tracing the execution of this little program step by step. Since there are five characters in 'aeiou', the statement on line 3 will be executed five times. The first time around, length is zero (the value assigned to it on line 1) and vowel is 'a'. The statement adds 1 to the old value of length, producing 1, and updates length to refer to that new value. The next time around, vowel is 'e' and length is 1, so length is updated to be 2. After three more updates, length is 5; since there is nothing left in 'aeiou' for Python to process, the loop finishes and the print statement on line 4 tells us our final answer.

Note that a loop variable is just a variable that’s being used to record progress in a loop. It still exists after the loop is over, and we can re-use variables previously defined as loop variables as well:
 
letter = 'z'
for letter in 'abc':
    print(letter)
print('after the loop, letter is', letter)
 
a
b
c
after the loop, letter is c

Phew!! That's sure a lot to digest in a class >.< in the next class, we will learn about a new topic and meet another lecturer! Stay tuned! <3

Saturday, 8 April 2017

Phyton for Beginner

Assalamualaikum and hi there :)

In previous class, we were asked to do a kind of study group in class regarding this topic which is called Phyton. If you guys do not have any idea about what is Phyton, kindly refer to our previous post. 😉



What? you still cant get it? 

Hehe, don't worry. In our class last Tuesday, Dr KB had taught us the right way to use it. and now...
We will share it to you guys!

First and foremost, why we use Phyton instead of other languages such as Lisp, C, or Java?
This is because Phyton is :


  • Easy to use
  • Easy to learn (good choice for beginner)
  • Readability (not waste time understanding mysterious syntax)
  • Powerful & versatile ( companies like Google, Dropbox, Spotify, and Netflix use it)
  • Minimal setup
  • Powerful libraries
  • Free and open source software, widely spread, with a vibrant community

So, when you installed miniconda or conda, Jupyter will come together.

Phyton Notebook

Here is the link to download Miniconda for less space laptop or computer

Lets get started!

Open Phyton and type "Phyton" to know your Phyton version in your computer.

For Multiple Assignment

-Phyton allows you to assign a single value to several variables simultaneously.  
For example: a=b=c=1
-You can also assign multiple objects to multiple variables. 
For example: a,b,c = 1,2, "zabirah"  *refer to diagram 1.1

For Phyton list

-A list contains items seperated by commas and enclosed within square brackets ([]).

For example:
course= ['biotech', 'chemistry' , 'plantsc' ]
The first course represent 0,1,2 and onwards.


For Phyton String

-The values stored in a list can be accessed using the slice operator ([ ] and [:]) with indexes starting at 0 in the beginning of the string and working their way to end -1.


When you type print (course[0:1] )
it will only appeared ['biotech'] . 
This is because second number which is 1 will be minus 1 and become 0. 
The first course written is 0 
*refer to diagram 1.1 for other examples.

It also can be written print (course [-1]) to represent the last course written, 
print (course [-2]) for second last, and so on.

You also can change the course name by typing course [number of position you want to change]  
For example course [2]= 'physics'
Then, plantsc will be replaced with physics.

To add course, type course.append ('cts')
and to delete, type course.pop (2) or delete course [1]


Diagram 1.1

For Phyton Tuples

-A tuple is another sequence of data type that is similar to the list. 
-A tuple consist of a number of values seperated by commas. 
-Unlike list, however, tuples are enclosed within parentheses and cannot be updated (read-only list)

Next, open your jupyter notebook,
then type conda --version, wait for the system to finish typing, type conda update conda, 
after that, type y, type conda create --name plantsc phyton =3, wait.
activate plantsc and lastly jupyter notebook

This is what we have done

 
                     


For the using of Jupyter Notebook

First, search Software Carpentry at google, click Lesson > Programming with Phyton (site) > setup. It will appear like this. Follow the instruction to download file.



Then, search Jupyter Notebook > Upload (file that you download just now)  
Instead of clicking on setup, go to Episodes > Analyzing Patient Data. A lot of powerful, general tools are built into languages like Phyton, specialized tools built up from these basic units live in libraries that can be use upon needed. So, here is the screenshot of what we have tried.

Hope it helps !










Fuhh, today's entry quite tough right 😓
But trust me, if you try to use it, its kind of exciting hehe
GOOD LUCK! 

Sunday, 2 April 2017

FIRST DAY WITH DR.KB

Assalamualaikum and hi 😊

We had a new class with our beautiful lecturer, Dr.KB or her full name Dr. Khairul Bariyah. We were excited to learn new knowledge from her. Her style in teaching was quite interesting. She did not taught us directly but indirectly. HoHoHo. What's that meaning? Do you curious guys?

Let me tell you..

She divided us with seven groups and each group had their own questions.

The lists of the questions:

1) What is Python? What is the difference between  Python and C
2) How to install Python
3) What are Python libraries?
4) What is Python Editor? Example: Jupyter notebook, IPython
5) What are the data types in Python  (hint: lists)
6) How to print and display a word (Hello) in Python?
7) How to generate a plot in Python? Which library you should use?

All of us have our own questions and we need to find the all information regarding the questions. After we had our points, we need to discuss in group about our topic to be more detail about that.

Then, we need to form a new group which each person have their own question. We need to explain about our own question to the group mate. It looks like we teach them. We gained information and share to others will make us be more understand about that topic and remember it in a long time.

 The advantage of this is we can ask questions to our friends without shy 😍😍.. Interesting, right?

The information about all the questions ^-^


1) What is Python? What is the difference between  Python and C


  • Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. It is simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. 
  • The difference between Python and C

Python
C
Released in 1991
Released in 1972
Easier and short
Coding complex and long
Programing is slower
Programming more faster
Have library
No library
Less symbol
More symbol
Does not support 8-bit, 16-bit, 32-bit, 64-bit integers and word size. It supports arbitrarily precise bignum data types
Support  8-bit integer, 16-bit integer,32-bit integer, 64-bit integers and word size
Supports non-moving, mark-and-sweep garbage collection with automatic garbage collector
Does not include a garbage collector. Boehm Garbage collector can be used as garbage collector for C

2) How to install Python

We are using Miniconda to install because it is more complete.

  1.  Type Miniconda
  2. Choose Python 3.6 (64-bit)
  3. Install
3) What are Python libraries?


**help you get started so that you don’t have to write code to reinvent the wheel. 

  • Numpy - It provides some advance math functionalities to python.
  • SymPy can do algebraic evaluation, differentiation, expansion, complex numbers, etc. 
  • Scipy : high-level data processing routines. Optimization, regression, interpolation, etc http://www.scipy.org/
  • Matplotlib : 2-D visualization, “publication-ready” plots http://matplotlib.org/
  • Python Imaging Library
  • PyGame – Python game engine
  • SQLAlchemy – database toolkit for python
  • wxPython. A gui toolkit for python. 
4) What is Python Editor? Example: Jupyter notebook, IPython
•IPython introduced a new tool named the Notebook. Inspired by scientific programs like Mathematica or Sage, the Notebook offers a modern and powerful web interface to Python.
•This interface can be used not only with Python but with dozens of other languages such as R and Julia. 
5) What are the data types in Python  (hint: lists)
Python has five standard data types −

  • Numbers
  • String
  • List
  • Tuple
  • Dictionary

Python supports four different numerical types :
  • int (signed integers)
  • float (floating point real vialues)
  • complex (complex numbers)
Python string:
•Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the string and working their way from -1 at the end.
•The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition operator. For example − see Example 6
Python lists:
  • Lists are the most versatile of Python's compound data types. A list contains items separated by commas and enclosed within square brackets ([]). 
  • To some extent, lists are similar to arrays in C. One difference between them is that all the items belonging to a list can be of different data type.
  • The values stored in a list can be accessed using the slice operator ([ ] and [:]) with indexes starting at 0 in the beginning of the list and working their way to end -1. 
  • The plus (+) sign is the list concatenation operator, and the asterisk (*) is the repetition operator. For example − see Example 8
Python tuples:
  • A tuple is another sequence data type that is similar to the list. A tuple consists of a number of values separated by commas. Unlike lists, however, tuples are enclosed within parentheses and cannot be updated (read-only list)

Python dictionaries:
  • Python's dictionaries are kind of hash table type. A dictionary key can be almost any Python type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary Python object.
  • Dictionaries are enclosed by curly braces ({ }) and values can be assigned and accessed using square braces ([]). 
6) How to print and display a word (Hello) in Python?

Type the code at Python :

  • print ("hello")
  • hello


7) How to generate a plot in Python? Which library you should use?
**use Matplotlib, http://matplotlib.org/

  • There are many type of plotting in the matplotlib
  • Choose the plot that we want.
  • Copy the code and paste at Jupyter(Python 2/ Python 3)
  • Edit the data that we want.
That's all that we had learnt last class. Hope you guys can get the knowledge..


Till we meet in the next post!!💓

Friday, 10 March 2017

ChemSketch and SMILES :)

Assalamualaikum everyone! We hope that you're in a good health and thanks for stopping by!~

We are excited to meet the new lecturer, Dr. Raihan Musa. The day before the class, which is on Monday, we were given a task by Dr. Raihan (through Whatsapp) to install a software called ChemSketch. We were asked to install the software because we need to use it in class.

Dr. Raihan made a game using this software. There are 2 groups; Pisang, and Jaguar. We were asked to draw these 4 molecules. And...the group with most students who finished draw the structures faster is...Pisang. Haha!


Next, Dr. Raihan asked us to search for the apparatus used in laboratory. Awesome, isn't it? If we were going to do a lab report and then were asked to draw the set-up of the experiment, we could just use this ChemSketch!


 The picture below are the structure of carbohydrates. If we were to draw carbohydrates in our assignments and reports, we could just use this template too. So we don't have to burden ourselves by drawing the hard carbohydrates structure. Just choose and click on the structure in the template below and Walla! you're done. Hehe, thank God this software exists! <3 there are lots of other tools and templates inside the ChemSketch, do check them out!


After the ChemSketch lesson, Dr. Raihan taught us SMILES. She did not teach us how to smile but the name of the lesson is SMILES. Haha >.< oh yeaaa...you didn't know what SMILES is, did you? :P hehe. SMILES is the abbreviation for Simple Molecular Input Line Entry System. It is used to translate a chemical's three-dimensional structure into a string of symbols that is easily understood by computer software.

Atoms are represented by the standard abbreviation of the chemical elements, in square brackets, such as [Au] for gold.

Bonds between aliphatic atoms are assumed to be single unless specified otherwise and are implied by adjacency in the SMILES string. Although single bonds may be written as "-", this is usually omitted. For example, the SMILES for ethanol may be written as C-C-O, CC-O or C-CO, but is usually written CCO. Double and triple are represented by the symbols '=' and '#' respectively as illustrated by the SMILES O=C=O (carbon dioxide) and C#N (hydrogen cyanide).

Ring structures are written by breaking each ring at an arbitrary point (although some choices will lead to a more legible SMILES than others) to make an acyclic structure and adding numerical ring closure labels to show connectivity between non-adjacent atoms. For example, cyclohexane and dioxane may be written as C1CCCCC1 and O1CCOCC1 respectively. For a second ring, the label will be 2. For example, decalin (decahydronaphthalene) may be written as C1CCCC2C1CCCC2.

Aromatic rings such as benzene may be written in one of three forms:
  1. In Kekulé form with alternating single and double bonds, e.g. C1=CC=CC=C1,
  2. Using the aromatic bond symbol ":", e.g. C:1:C:C:C:C:C1, or
  3. Most commonly, by writing the constituent B, C, N, O, P and S atoms in lower-case forms 'b', 'c', 'n', 'o', 'p' and 's', respectively.
In the latter case, bonds between two aromatic atoms are assumed (if not explicitly shown) to be aromatic bonds. Thus, benzene, pyridine and furan can be represented respectively by the SMILES c1ccccc1, n1ccccc1 and o1cccc1.

Pheww! That's a lot!!

Dr. Raihan announced that, on the next Tuesday, we have a quiz on this topic >.< there will be 4 questions with a total mark of 10. Do wish us the best in answering the quiz! See you again next week :-)

Wednesday, 1 March 2017

Presentation Day!!!!!!!

Assalamualaikum guys, we are back ! 😇 hope all of you in the blessing of Allah.

          As we mention before, our class will have a presentation about the gene this week. So, in the group of five we have finished our assignment and prepared for presentation. Here are the list of the gene that had present by each group : 

  1. RLF
  2. COL1A1
  3. COL3A1
  4. COL9A1
  5. IL10
  6. BRCA1
  7. CD4
  8. CD8
  9. IL2
  10. ALB
  11. LCK
  12. BCLA2
  13. ABO
  14. OSM
  15. NPPB
Dr Azran had evaluated each of the group with the suitable marks. These are a few pictures of the groups on the presentation day.





After finish all the presentation. Dr Azran said that all of our presentation were good but a few comment were given about the slide in term of the choosing of  the background colour, the font size and islamization. He related the gene with the "jin" also. He said that both of them cannot be seen with our naked eyes but both of them give big influence to us. He also remind us that we need to be closed to our Creator and always take care of ourself..

 Suddenly, after all the comment and the sharing session about gene and "jin" end, he said that this class was the last class with him and Dr Raihan will replace him. 😭 We not expect that it is our last class with this kind, nice and cute lecturer. We hope that he will always in a good condition and in be bless by Allah. 

See you when i see you Dr 👋😭

 So, who is DR RAIHAN ? 👀
wait for our next entry hehe. See you again.
Assalamualaikum 💓