Born Believers: শিশুর সহজাত আস্তিকতা

Are babies born believers? Or the idea of God is only limited to adults? With the rise of developmental psychology in the last hundred years, research showed interesting and astonishing results. “Born Believers: The Science of Children’s Religious Belief” written by Justin L. Barrett (PhD) describes all of this in detail with scientific evidence both for and against.

লেখাটির বাংলা ভার্সন পড়ুন এখানে

Just Myth or a Fact?

In Islam, there is a concept called “Fitra” or the “embed nature.” It is indicated even in The Quran. According to this phenomenon, Allah embedded the loyalty to Him into our soul when He created it. Therefore, human beings are naturally inclined to believe in some sort of God. It does not need to be forced on him/her. Other major religions also have similar beliefs. But this is what religion tells us; what about science?

Children’s Idea of God

Before asking whether a child believes in God or not, it is essential to know, “Can a child even recognize God?” According to the research, children can identify living things, physical objects, humans, and many more. They can identify the presence of both seen and unseen agents (things/beings). Not only that, they are eager to know the “why” or the reasoning behind everything. So, if there is a God, a child possesses the ability to identify Him.

Many scientific studies have shown that children are naturally inclined to God’s idea as if they know Him very well. In fact, sometimes better than adults; especially in understanding supernatural powers like – beyond time-space, controls everything, the infinity of His properties.

How do they Know Him?

But how!? How do they know Him? The easy answer is – “From parents.” Not so fast! The writer presented many studies against the “Indoctrination Hypothesis” or “taught by parents.”

For instance – If parents do not brainwash their child, would we lose all the religion from the world? Hypothetically, if atheism is natural, an atheist parent’s child would remain atheist (but evidence shows otherwise). A calculation shows that, in that scenario, after 6 generations (approx 200 years), only 5% of the world population would be religious. But we do not see that, do we? Hinduism is here for thousands of years. Buddhism, Christianity, Judaism, Islam are also surviving strongly for thousands of years. So, it is not “indoctrination,” something else must be going on.

Evidently, children do not simply trust what their parents or other authority figures tell them. If a child would listen/believe his parents that easily, our parents’ lives would be more comfortable and pleasant. Parents know this very well. They just hope that their child listens or at least pretends to believe them. Furthermore, research shows that indoctrination can backfire, resulting in the child not being interested in what is taught anymore.

Should Parents Play Any Role

Outspoken atheists of present time like Dawkins and Hitchens compares parents effort to teach their children religiosity to the child (sexual) abuse. It is well documented in the scientific studies that – if a family follows the religious value more, the children would be more mentally, spiritually, socially, and physically healthy. In contrast, the negative effect of child abuse is also well documented. However, there is no scientific evidence on the relation/connection between these two’s experiences. Thus, without any structured scientific relation between them, such claim of Dawkins and Hitchens in their lectures, writings is irresponsible in general and dangerous for science. Undoubtedly, parents’ responsibility is to ensure that their children grow up as good human beings.

Interestingly, the book also discusses in detail whether atheism is natural in children. In fact, it compiled a list of suggestions to become a successful atheist!

Parenting is Important!

It is evident from the research works of the last hundred years that children have a natural tendency towards believing in God. Yet, born believers need proper training to better utilize it. There is a story in the book. A child was asked how does he follow Jesus without seeing him? He answered, “I just watch daddy – he has to live like Jesus, and I have to live like him.”

Children primarily want to be like their parents. At an early age, they try to find their hero in them. Thus, despite being born believers, parents play an important role in later development. For example- every child has a natural tendency to eat when s/he is hungry. But it takes guidance to teach him what to eat and what not to, what is healthy and what is not. In the last two chapters, the book discusses what role parents should play in children’s theological development.

Choice is Theirs –

In the conclusion of the book, the writer commented – people are free to make their own decision. Parents, teachers, and caregivers should make a proper effort to pass down what they believe as truth. But at the end of the day, it is their choice if they become a true believer or not.

Though children may be born believers, whether they die believers is between them and God.


GRExit
GRExit: You may not need GRE anymore to study in the 🇺🇸

When I first came to know that GRE is required to pursue higher study in the US, I completely ignored considering the US for my Ph.D. I did not want to invest my time into something that I would not need in my future research/work. instead of reading tons of vocabulary ? and practicing high-school math problems ?, I focused on expanding research knowledge – things that would help.

GRE is going away!

Those who are like me – who do not want to study for GRE (who does? ?), it is good news that GRE is going away! In the last few years, most of the top universities are gradually dropping the GRE requirement. It has been 80 years since the top US universities introduced GRE. And now, they are the ones who are getting rid of it. Could we say that – through the end of an 80 years-long experiment, GRExit once again points out that human capabilities can not be measured using a unified scoring system (See here [1])?

#GRExit Trend

Recently, I was at a conference, where I had the opportunity to hear directly from Scott Barolo, Director of the Program in Biomedical Sciences (PIBS) at University of Michigan. Dr. Barolo is the pioneering figure who made this pivotal decision to drop GRE requirement from PIBS admission requirement in 2017 [2]. Soon after this, other major universities including Harvard, Caltech, Carnegie Mellon, Cornell, Johns Hopkins, and many others followed the same path [3,4]. You can find an almost full list of Bio/Medical programs that do not require GRE here [4].

An article from 2019 in a popular scientific journal “Science” discusses GRExit trend [1]

As a Health/Bio-medical science student, I am very happy to see that Biological science programs are leading in this paradigm shift. Computer science and other programs are also welcoming this change gradually.

Prepare yourself for the opportunity!

It is encouraging to see this GRExit movement when I think about future students. It makes more sense to take students through the “evidence-based” admission system. Meaning, admitting students based on their expertise and experience evidence. As a result, students will be able to give full focus on something that will “actually” help in their higher study. Furthermore, given the quality of higher education in the US, it will surely open the window of opportunity for many students to get the proper facility that they deserve for their higher study. Therefore, I would recommend students to go through the programs and universities you are interested in and prepare yourself accordingly.

Sources:
[1] GRE vs Grad School Success: https://synapticsketch.wordpress.com/2019/01/11/the-gre-a-sinister-sieve-screening-out-stem-talent/
[2] University of Michigan dropped GRE requirement in 2017: https://www.sciencemag.org/careers/2017/08/updated-biomedical-phd-program-major-research-university-drops-gre-requirement
[3] Trends of GRExit: https://www.sciencemag.org/careers/2019/05/wave-graduate-programs-drop-gre-application-requirement
[4] Programs that dropped GRE requirement: https://docs.google.com/spreadsheets/d/1MYcxZMhf97H5Uxr2Y7XndHn6eEC5oO8XWQi2PU5jLxQ

করোনাঃ আতঙ্ক নয় প্রয়োজন সচেতনতা
আতঙ্ক ভুলে সেবার এক মহান সুযোগ হোক করোনা

“বিপদে আমায় রক্ষা করো এনহে মোর প্রার্থনা
বিপদে যেন না করি ভয়”

রবীন্দ্রনাথ ঠাকুর

যখনই কোনো আতঙ্ক ছড়ানোর সুযোগ সৃষ্টি হয়, কিছু শ্রেনী সেখানে নিজেদের স্বার্থ হাসিলের চেষ্টা করে এবং এখনও সেটা চলছে। নিজেদের স্বার্থে ফুলিয়ে-ফাঁপিয়ে এটাকে একটা ভয়ঙ্কর বিষয়ে পরিনত করেছে তারা। করোনা নিয়ে সচতনতার চেয়ে এখন আতঙ্কই বেশি। কিন্তু এই আতঙ্ক কতোটা যৌক্তিক –

১। নতুন কিছু নয়, নতুন ধরন মাত্র

আমরা জানি যে, করোনা নতুন কোনো ভাইরাস/রোগ নয়। পুরোনো ফ্লু’র নতুন এক ধরনের ভ্যারিয়েশন মাত্র। স্বাভাবিকভাবেই নতুন ভাইরাসের সাথে ফাইট করার মত শক্তিশালী ইমিউন সিস্টেম তরুন বা শিশুদের যেমন থাকে, প্রবীণ বা দীর্ঘমেয়াদী রোগ আছে এমন মানুষদের ক্ষেত্রে তা তুলনামূলক দুর্বল থাকে। যে কারনে, সবচেয়ে বেশী ঝুঁকির মধ্যে আছেন তারা। ২০১৮-১৯ এ আমেরিকাতে ফ্লুতে মৃত্যু বরণ করা ৩৪,২০০ জনের মধ্যে ৭৫% হচ্ছেন প্রবীন []।

২। বাস্তবতা

সিজনাল ফ্লুতে (শীতকালীন হালকা জ্বর, সর্দি, কাশি) সারা পৃথিবীতে প্রতিবছর শুধু ফুসফুস জনিত ইনফেকশনেই প্রায় সাড়ে ৬ লক্ষ লোক মারা যান [,,]। আর বছরে আক্রান্ত হন প্রায় ১ বিলিয়নেরও বেশী [,]। অন্যদিকে করোনা তে গত তিন মাসে আক্রান্ত প্রায় ৭ লক্ষ, যার মধ্যে মৃত্যুবরণ করেছেন ৩২ হাজার []।

“লাখে লাখে সৈন্য মরে কাতারে কাতার,
শুমার করিয়া দেখি পঞ্চাশ হাজার।”

যেই রোগের ৭০-৯০ শতাংশের জন্য হাসপাতালে যাওয়ারও প্রয়োজন হয় না [,], তা নিয়ে আতংকিত হওয়ার চেয়ে প্রয়োজন সচেতন থেকে নিজ নিজ সরকার আর স্বাস্থ্য বিভাগের সহজ নির্দেশনাগুলো অনুসরন…

৩। ইউরোপ/আমেরিকার দুরাবস্থা কেন?

ইরানের ক্ষেত্রে তাদের ধর্মীয় গোরামী বা ধর্মান্ধতা আর সরকারের উদাসীনতা একটা বড় কারন। আর ইতালীর ক্ষেত্রে – পৃথিবীতে যে কয়টি দেশে বয়স্ক মানুষের হার সবচেয়ে বেশী তাতে দ্বিতীয় ইতালী (২৩%) []। ইউরোপিয়ান অধিকাংশ দেশেরই একই অবস্থা। বয়সভিত্তিক মৃত্যুহারের দিকেও ফ্লুতে মৃত্যু কিন্তু ইউরোপেই সবচেয়ে বেশি (৮৪%), আর দ্বিতীয় স্থানে পুরো আমেরিকা মহাদেশদ্বয়(৭৫%) []। অতএব, সচেতন না হলে ইউরোপ, আমেরিকা যে সবচেয়ে কঠিন চ্যালেঞ্জের মধ্যে পরবে সেটা অনুমেয়।

৪। আমাদের উপমহাদেশ

ভারতে এ পর্যন্ত আক্রান্ত ৯৮৭আর মৃত্যু মাত্র ২৫! ভারতের ডেমোগ্রাফি যেহেতু অনেকটাই বাংলাদেশের মত, তাই তুলনাটা সহজ। দুটি দেশই জনবহুল। কিন্তু এরপরেও করোনার হানা ইউরোপের মত না হওয়ার একটা বড় কারন এই অঞ্চলের মানুষের বয়স (তরুনদের সংখ্যা) এবং তাদের ইমিউন সিস্টেম। সে সাথে আবহাওয়াও গুরুত্বপূর্নভূমিকা পালন করছে []। সবমিলে এ অঞ্চলের মানুষের ফ্লুতে মৃত্যু অন্য অঞ্চলের চেয়ে সবসময়ই কম। ধরে নিলাম, অফিসিয়ালি যা বলা হচ্ছে আসল রূপ তার ৩ গুন। তা হলেও মৃত্যু সংখ্যা ১০০’র নিচে, যা ঘনবসতিপূর্ন বিশ্বের দ্বিতীয় জনবহুল দেশের (১৩৮ কোটি) জন্য কম।

৫। আতঙ্কের কিছু নেই

অতএব, করোনা নিয়ে আতংকিত হবার চেয়ে প্রয়োজন সচাতনতার। সরকার তাদের দায়িত্ব যথাসম্ভব পালন করার চেষ্টা করে যাচ্ছে (কেউই ভুলের উর্ধ্বে নয়), কিন্তু আমাদের কাছ থেকে সহযোগিতা না পেলে সেটা ম্যানেজ করা আরও দুঃসাধ্য হয়ে পরবে।

খুব খারাপ লাগে যখন দেখি হাসপাতাল নির্মানে বাঁধা দেয়া হচ্ছে, বয়স্ক শ্রমজীবীদের খাবার দেয়ার পরিবর্তে তাদের কান ধরে উঠবস করানো হচ্ছে, তরুন/যুবক ডাক্তার/নার্সরা পেশেন্টের কাছে যাচ্ছেনই না, ভয়ে… আতঙ্কে; ভাইরাস আক্রান্ত ব্যাক্তির কবর/সৎকারের বিরুদ্ধে মানুষ আন্দোলন করছে, কিংবা অসুস্থ একজন আশেপাশের কাউকে পাশে পাচ্ছে না। জবাবদিহিতার দিনে আল্লাহ যেদিন প্রশ্ন করবেন – “আমি অসুস্থ ছিলাম, তুমি আমার খোঁজ রাখো নি। আমি ক্ষুধায় কাতর ছিলাম, আমাকে খাবার দাও নি।” তখন কি উত্তর দিব আমরা?

৬। সেবা আর প্রার্থনার মাধ্যমে করুনাময়ের রহমতের ছায়ায় থাকুন

আমাদের আচরন আরেকজন মানুষকে যেমন ঝুঁকিতে ফেলে দিতে পারে, তেমনি আমাদের আচরণই পারে এই সঙ্কট থেকে তাদের মুক্ত করতে। প্রবীন যারা আছেন তাদের সেবা-যত্ন নিশ্চিত করার দায়িত্বটা তরুণদেরই। তারা বসায় থাকতে থাকতে যেন বোরডোমে না ভোগেন সেটাও খেয়াল রাখতে হবে। আমাদের দেশে অনেক শ্রমজীবী আছেন যারা বয়স্ক। তারা যেন ঠিকভাবে সেবা পায়। আর নর্থ আমেরিকায় যেহেতু এই গ্রুপ বেশি তাই এখানেও সচেতন হওয়া জরুরী।

৭। শেষ কথা

ভালো লাগে যখন দেখি কিছু মানুষ পারিপার্শ্বিক বাঁধার দিকে না তাকিয়ে দায়িত্ব পালন করে যাচ্ছেন; পয়সা দিয়ে, খাবার দিয়ে, শ্রম দিয়ে অন্যদের সেবা করে যাচ্ছেন। আবার অনেক ডাক্তার আছেন, সারা পৃথিবীতে রিসোর্স সল্পতার বাস্তবতাটা মেনে নিয়ে একটু ঝুকি নিয়েই সেবা দিয়ে যাচ্ছেন। মৃত্যু হলেও এই ডাক্তারের চেয়ে সৌভাগ্যবান কয়জন হতে পারবেন?

খেয়াল রাখতে হবে “সামাজিক দূরত্ব” তৈরির মাধ্যমে আমরা যেন মানুষ হিসেবে আমাদের পরস্পর প্রতি মানবিকতা, দায়িত্ব, মমতা হারিয়ে না ফেলি।

সূত্রসমূহ

  1. https://www.cdc.gov/flu/about/burden/2018-2019.html 
  2. https://dx.doi.org/10.7189%2Fjogh.09.020421
  3. https://apps.who.int/iris/handle/10665/311184
  4. https://doi.org/10.1016/S0140-6736(17)33293-2
  5. https://coronavirus.jhu.edu/map.html
  6. https://www.cdc.gov/mmwr/volumes/69/wr/mm6912e2.htm
  7. https://nationalpost.com/news/world/covid-19-in-canada-six-per-cent-of-cases-need-hospital-care-one-per-cent-are-fatal
  8. https://data.worldbank.org/indicator/SP.POP.65UP.TO.ZS?name_desc=false&view=chart
  9. https://doi.org/10.1155/2011/734690
  10. কভার ছবিঃ https://www.kare11.com
The Problem with Python Package Structure in dev Mode

If you are trying to develop a python package and facing difficulties in doing so, this article may help.

The Issue

Recently, I was trying to develop a python package for a data science project. I generated my project using Data Science Cookiecutter. The folders were organized in the following way –

    ├── LICENSE
    ├── Makefile           <- Makefile with commands like `make data` or `make train`
    ├── README.md          <- The top-level README for developers using this project.
    ├── data
    │   ├── external       <- Data from third party sources.
    │   ├── interim        <- Intermediate data that has been transformed.
    │   ├── processed      <- The final, canonical data sets for modeling.
    │   └── raw            <- The original, immutable data dump.
    │
    ├── docs               <- A default Sphinx project; see sphinx-doc.org for details
    │
    ├── models             <- Trained and serialized models, model predictions, or model summaries
    │
    ├── notebooks          <- Jupyter notebooks. Naming convention is a number (for ordering),
    │                         the creator's initials, and a short `-` delimited description, e.g.
    │                         `1.0-jqp-initial-data-exploration`.
    │
    ├── references         <- Data dictionaries, manuals, and all other explanatory materials.
    │
    ├── reports            <- Generated analysis as HTML, PDF, LaTeX, etc.
    │   └── figures        <- Generated graphics and figures to be used in reporting
    │
    ├── requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
    │                         generated with `pip freeze > requirements.txt`
    │
    ├── setup.py           <- makes project pip installable (pip install -e .) so src can be imported
    ├── src                <- Source code for use in this project.
    │   ├── __init__.py    <- Makes src a Python module
    │   │
    │   ├── data           <- Scripts to download or generate data
    │   │   └── make_dataset.py
    │   │
    │   ├── features       <- Scripts to turn raw data into features for modeling
    │   │   └── build_features.py
    │   │
    │   ├── models         <- Scripts to train models and then use trained models to make
    │   │   │                 predictions
    │   │   ├── predict_model.py
    │   │   └── train_model.py
    │   │
    │   └── visualization  <- Scripts to create exploratory and results oriented visualizations
    │       └── visualize.py
    │
    └── tox.ini            <- tox file with settings for running tox; see tox.testrun.org

In Python, you can install your local package using pip install -e . It allows you to install your package as you develop it and allows importing your own modules (that resides in your package/project) easily. If you are confused about python packages vs modules and how they work, you can read this article.

Despite developing my own package before, I was not able to properly install and import it this time.

>>> import my_pacakge
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named my_package

What I tried-

__init__.py: Checked and made sure it was there.
checking pip list: My local dev package (my_package) was listed there
checking sys.path: sys.path had my project path. Please note, if you install your development package through pip install -e . then sys.path should have the package path.

I was using conda on windows. So I thought it was some permission issue. So I followed this and gave all the permissions for Anaconda. But that does not solve the problem either. I still thought it was some windows/conda permission or path related issue until I installed another local development package of mine. That package works!!

So it has to be some setup.py related issue?

In the working version – all of my source code for the package was in a root folder with the same name of the package. But in the current one, root folder for all the package code is src folder and I tried to declare setup.py in following way –

from setuptools import find_packages, setup
setup(
    name='my_package',
    package_dir={'': 'src'},
    packages=find_packages('src'),    
    version='0.1.0',
)

I tried to print find_packages(‘src’) and it was returning the modules perfectly – ['my_package', 'my_package.data', 'my_package.features', 'my_package.models', 'my_package.visualization'], but was not working when I installed it in developer mode.

The Solution (or Problem?)

With hours of searching, I found the real problem in this very old github issue posted in pip repo (also here). It seems setuptools (and thus pip) does not like renaming the package root folder in developer mode. Finally, the problem was resolved by creating a folder with the same name as the package (inside src; look bellow for reference) and then move everything there. You can put the folder anywhere in your project, but I put it in src folder for my organization. In that way I could put my tests in src/tests and make the project root tidy.

The original issue, however, remain unresolved. I have not found anything that follows up the issue on Pip or setuptools repository.

# setup.py
from setuptools import find_packages, setup

setup(
    name='my_package',
    package_dir={'': 'src'},
    packages=find_packages('src'),    
    version='0.1.0',
    description='A short description of the project.',
    author='K.M. Tahsin Hassan Rahit'
)

    ├── LICENSE
    ├── Makefile
    ├── README.md
    ├── data
    ├── docs
    ├── models
    ├── notebooks
    ├── references
    ├── reports
    ├── requirements.txt
    ├── setup.py           			<- makes project pip installable (pip install -e .) so src can be imported
    ├── src
    │   ├── my_package	   			<- Source code for use in this project.
    │   │	├── __init__.py			<- Makes my_package a Python module
	│	│   ├── data
	│	│   │   └── __init__.py		<- Makes my_package.data a Python module
	│	│   │   └── make_dataset.py
	│	│   │
	│	│   ├── features
	│	│   │   └── __init__.py		<- Makes my_package.features a Python module
	│	│   │   └── build_features.py
	│	│   │
	│	│   ├── models
	│	│   │   └── __init__.py		<- Makes my_package.models a Python module
	│	│   │   ├── predict_model.py
	│	│   │   └── train_model.py
	│	│   │
	│	│   └── visualization
	│	│   │   └── __init__.py		<- Makes my_package.visualization a Python module
	│	│   │   └── visualize.py
    │   ├── tests	   			<- Tests file for my source code
    │
    └── tox.ini
Radioactive warning sign
হাজার বছর ভবিষ্যতের মানুষের সাথে কথা বলা
রূপপূরে পারমাণবিক বিদ্যুৎকেন্দ্র হচ্ছে। এই কেন্দ্রে বিদ্যুৎ উৎপাদনের পরে পারমাণবিক জ্বালানির যে তেজস্ক্রিয় উচ্ছিষ্ট তৈরী হবে তা রাশিয়া নিয়ে যাবে। কিন্তু তারা এটা নিয়ে আসলে কি করবে? 
 
বিশেষ কিছুই করবে না… তারা অস্থায়ীভাবে এই উচ্ছিষ্ট একটি জায়গায় ডাম্প করে রাখবে। কারণ, তেজস্ক্রিয় উচ্ছিষ্ট বা নিউক্লিয়ার ওয়েস্টের ফেলে রাখার স্থায়ী কোন জায়গা/প্রক্রিয়া নেই। এর মূল কারণ কিন্তু জায়গার অভাব না। কিংবা এটাও কারণ না যে আমরা জানি না যে তেজস্ক্রিয়তাকে কিভাবে আটকে রাখতে হবে। এর মূল কারণ আসলে আমরা জানি না ভবিষ্যতের মানুষের সাথে কিভাবে কথা বলতে হবে। 

 

ভবিষ্যতের মানুষের সাথে কেন কথা বলা দরকার? 

ধরা যাক, পুরো পৃথিবী একমত হয়ে একটা নির্দিষ্ট স্থানে “স্থায়ীভাবে” সব নিউক্লিয়ার ওয়েস্ট ফেলার জন্য একমত হলো (এরকম স্থায়ী ফ্যাসিলিটি ফিনল্যান্ডে আছেও- Onkalo spent nuclear fuel repository)। সেখানে সেটা ফেলে জায়গাটি সিলগালা করে বন্ধ করে দেয়া হলো। সাথে ঝুলিয়ে দেয়া হলো বিশাল এক “প্রবেশ নিষেধ” বা “বিপদজনক” সাইন। তাতেই কি শেষ?

“স্থায়ীভাবে” কেনঃ অনেকেই জানেন যে, তেজস্ক্রিয়তা হাজার থেকে কয়েক লক্ষ বছর পর্যন্ত বিকিরিত হতে পারে এবং মৃত্যুর কারণ হতে পারে। অতএব, এই তেজস্ক্রিয় উচ্ছিষ্টকে শুধু নিরাপদে ডাম্প করে রাখলেই হলো না, হাজার/লক্ষ বছর ধরে সেই জায়গাটিতে কেউ যেন প্রবেশ করতে না পারে সে ব্যবস্থা নিতে হবে। আর এখানেই সবচেয়ে বড় বাঁধা। আর মানুষের কৌতূহলী মনই এই সমস্যার সবচেয়ে বড় চ্যালেঞ্জ। 

চিন্তা করে দেখুন হাজার বছর আগের বিভিন্ন জাতির ধ্বংসাবশেষ নিয়ে আমাদের কত গবেষণা, হাজার বছের আগের যেটা কবর, সেই পিরামিডকে ঘিরে আমাদের কত কৌতূহল, কত পরীক্ষা নিরিক্ষা। কোথাও গিয়ে কোনো এক্সপ্লোরার অসুস্থ বা মারা গেলে সেখানের প্রতি আগ্রহ তো আরও বেড়ে যায়… তাই মানুষের কৌতূহল থেকে নিরাপত্তা দেয়ার সঠিক ব্যবস্থা নিতে হবে এই নিউক্লিয়ার ডাম্পিং প্লেসের। 

 
ISO radiation warning sign

তেজস্ক্রিয়তার বিপদ বোঝাতে প্রস্তাবিত বিপদ সংকেত 
(সূত্রঃWikipedia)

Curse written on an Egyptian tomb

প্রাচীন মিশরের একটি পাতাল গুপ্ত ঘর থেকে প্রাপ্ত অভিশাপ এবং সতর্কতাবার্তা সংবলিত স্লেট।
ভবিষ্যতের মানুষেদের কাছেও কি আমাদের সতর্কবার্তা নিছক সেকেলে অভিশাপ মনে হবে?
(সূত্রঃWikimedia)

 
ভবিষ্যতের মানুষের সাথে কথা বলার চ্যালেঞ্জটা কোথায় সেটা বোঝার জন্য এই বড় প্রব্লেমটাকে একটু ভেঙে ফেলা যেতে পারে-

১. কি এবং কতটুকু বলবো?

কি বললে তাদের কাছে বিপদের বার্তা সঠিকভাবে পৌঁছানো যাবে? কতটুকু বললে তাদেরকে তেজস্ক্রিয়তা এবং এর ক্ষতিকারক প্রভাব বোঝানো যাবে (এক প্যারাগ্রাফ? এক লাইন? কয়েক পৃষ্ঠা? নাকি বইসম কিছু)? হতে পারে এমন কিছু ঘটলো ভবিষ্যতের মানুষ জানে না যে “তেজষ্ক্রিয়তা কি” বা “এর এর প্রভাব কি”? আবার উল্টোটিও তো হতে পারে… তারা হয়তো সে সময়ে তেজস্ক্রিয়তার আরও স্মার্ট  সমাধান বের করে ফেলেছে?

২. কিভাবে বলবো?

চিন্তা করে দেখুন পাঁচ বা দশ হাজার বছর আগের কোন ভাষায় কি এখন কেউ কথা বলে? কেউ যদি এখন আপনার সাথে সংস্কৃত ভাষায় কিছু বলা শুরু করে তাহলে কি আপনি কতটুকু বুঝবেন? 

ভাষা একটি পরিবর্তনশীল প্রযুক্তি। ভবিষ্যতে ইংরেজি ভাষাও যে টিকে থাকবে তার কি কোনো নিশ্চয়তা আছে? বিজ্ঞানীরা অবশ্য আপাতত একটা জিনিস চিন্তা করে রেখেছেন। সেটা হচ্ছে জাতিসংঘের অফিসিয়াল ৬ টি (ইংরেজি, আরবি, স্প্যানিশ, ফ্রেঞ্চ, চাইনিজ এবং রাশিয়ান) ভাষায় একই সাবধান বার্তা লিখে রাখা। এই আশায় যে হয়তো কোনো একটি ভাষা বা তার পরিবর্তিত রূপ টিকে থাকবে। বার্তার সাথে সাথে বিপদজনক সংকেতও ব্যবহার করার প্রস্তাব রাখা হয়েছে।

কি হবে সেই বার্তা কিংবা সংকেত তা নিয়ে ১৯৯৩ সালে মার্কিন যুক্তরাষ্ট্রের ডিপার্টমেন্ট অব এনার্জি সুদূর ভবিষ্যতের মানুষের কাছে বিপদবার্তা পৌঁছানোর উপরে প্রায় ৩৫০ পাতার একটা গবেষণা রিপোর্ট প্রকাশ করে [১]। যেখানে নিম্নোক্ত বিপদবার্তাটি প্রস্তাব করা হয় (হুবহু দিলাম) – 

 

nuclear warning text to future
 

তবে উপরোক্ত বিপদবার্তাটি পড়ার পরে আমার মনে হয়েছে – এটা দেখলে যে কারও আগ্রহ অন্তত আরও দ্বিগুন বেড়ে যেতে পারে। বড়ই কৌতুহলৌদ্দীপক বার্তা…

এটি নিয়ে চিন্তা করতে করতে মনে হলো, ভাষা যদি সমস্যাই হয়, তবে হাজার বছর পরে কোরআন কিভাবে টিকে থাকবে !? শুধু তাই নয়, ১৪০০ বছর আগের আরবি আর এখনকার আরবি ভাষাও তো এক হবার কথা না!

উত্তর খুঁজতে খুঁজতে জানতে পারলাম, আরবি ভাষাও নবীজী (সাঃ) এর সময় থেকে এখন অনেক পরিবর্তন হয়েছে। তবে শব্দগুলো তার কন্সেপচুয়াল এবং সে সময়কার কন্টেক্সচুয়াল অর্থসহ সংরক্ষন করা আছে (তবে এখানেও অনেক গবেষণার সুযোগ আছে)। ভাষাবিজ্ঞানে এটি করা হয় বিশেষ এক প্রক্রিয়ায় – যা লেক্সিকোগ্রাফি নামে পরিচিত। ব্যক্তিগতভাবে বছর চারেক আগে আমার গবেষণা ছিল – বাংলা ভাষার একটি শব্দের সাথে ইংরেজী ভাষার একটি শব্দ কন্সেপচুয়ালি কিভাবে ম্যাপ করা যায় তা নিয়ে। তাই এ ব্যাপারে কিছু ধারণা আছে। যাই হোক…

এখানেই শেষ করবো। কারণ ভবিষ্যতের মানুষদের সাথে কিভাবে যোগাযোগ করতে হবে তা এখনও আমরা জানি না। বিজ্ঞানে যে কত ইন্টারেস্টিং প্রব্লেম আছে তার একটা ছোট্ট উদাহরণ এটি। শিক্ষার্থী জীবনে “এইটা শিখে আমার জীবনে কি লাভ হবে?” এইটা মনে হয় নি এরকম মানুষ খুব কমই আছে মনে হয়। অথচ পারমাণবিক গবেষণাতেও ভাষাবিজ্ঞান থেকে শুরু করে প্রত্নতত্ব কতকিছু কাজে লাগছে! আর গবেষণায় যখন বহুমুখী জ্ঞান একত্র করা হয়, তখনই বিজ্ঞান এগিয়ে যায়।

 
 
[১] Trauth, K.M., Hora, S.C., & Guzowski, R.V. (1993) Expert judgment on markers to deter inadvertent human intrusion into the Waste Isolation Pilot Plant. United States. http://doi.org/10.2172/10117359 

 

ওল্ড মন্ট্রিয়ালের একাংশ
কানাডার বুকে এক টুকরো ফ্রান্স

এবারের গ্রীষ্মে বেশ কয়েক জায়গায় ভ্রমণের সুযোগ হয়েছে। মাসখানেক আগে ২ সপ্তাহের সফরে কানাডার মন্ট্রিয়াল আর আমেরিকার নিউ ইয়র্ক ঘুড়ে আসলাম। আজকে একটু সময় পেয়ে মন্ট্রিয়ালের সফর সম্পর্কে লিখছি।

অনেকে জেনে থাকবেন কানাডায় ইংরেজ এবং ফরাসী দুই ঔপনিবেশিকেরই উপনিবেশ ছিল। কানাডার পূর্বাঞ্চলিও ক্যুবেক এবং মন্ট্রিয়াল এরিয়াতে ফরাসী প্রভাব বেশী ছিল। এখানের মূল ভাষাও ফ্রেঞ্চ। শহরের একটা অংশে এখনও ইউরোপিয়ান ভাইব আছে।

মাউন্ট রয়েলের উপর থেকে মন্ট্রিয়াল

মাউন্ট রয়েলের উপর থেকে মন্ট্রিয়াল

চারিদিকে নদী ঘেরা মন্ট্রিয়াল বেশ বড় শহর। ২ দিনে পুরোটা দেখার সুযোগ না হলেও শহরের আদি অংশ বা “ওল্ড মন্ট্রিয়াল”, ম্যাকগিল ইউনিভার্সিটির প্রত্নতাত্মিক জাদুঘর, বোটানিক্যাল গার্ডেনসহ বেশ ভালো একটা অংশ ঘুড়ে দেখার সুযোগ হয়েছে। আর সেটা করেছি দিনে প্রায় ৭০ কি.মি. সাইকেলে চালিয়ে!

মন্ট্রিয়ালে থাকা বন্ধুসম এক ছোটভাইকে সাথে নিয়ে ২৪ ঘন্টার জন্যে ৫ ডলারের বিনিময়ে সাইকেল ভাড়া নিয়েছিলাম। অনেক বড় শহরেই এরকম সাইকেল ভাড়া পাওয়া যায়। রাস্তার মোড়ে মোড়ে সাইকেল মাউন্টিং/ডিস্মাউন্টিং প্লেস থাকে। তাই সুবিধামত প্রয়োজনে লম্বা দূরত্বের জন্য বাস/ট্রেন ব্যাবহার করে নেমে আবার সাইকেল ব্যাবহার করা যায়। ট্রাভেলারদের জন্য এটা ভালো কারন সিটি ট্যুরটা খুব ভালো হয় এবং শহরের জীবন যাত্রা অনেক কাছ থেকে দেখা যায়।

নটর ডেম বেসিলিকা

মন্ট্রিয়ালে দেখা সবকিছুর মধ্যে নটর ডেম বেসিলিকা বা নটর ডেম চার্চ আলাদা হয়ে থাকবে। বলে নেয়া ভালো, এই নটর ডেম আর ফ্রান্সের নটর ডেম ক্যাথেড্রিয়ালের দু’টো আলাদা চার্চ। অনেকে গত এপ্রিলে ফ্রান্সের নটর ডেম ক্যাথিড্রাল আগুনে পুড়ে যাওয়ার খবর শুনেছেন। একই সঙ্গে দুঃখজনক এবং মজার ব্যাপার হচ্ছে মন্ট্রিয়ালের এই নটর ডেম চার্চটির একটি অংশও বছর চল্লিশেক আগে আগুনে পুড়ে গিয়েছিল।

বাইরে থেকে নটর ডেম বেসিলিকা

বাইরে থেকে নটর ডেম বেসিলিকা

মন্ট্রিয়ালের নটর ডেম প্রায় ৩৫০ বছরের পুরোনো একটি ক্যাথলিক চার্চ। ইউরোপিয়ানরা ১৬শ শতকের মাঝে যখন মন্ট্রিয়াল আসে তখন খ্রিষ্ট ধর্ম প্রচারের জন্য এটি তৈরী করে যা মন্ট্রিয়াল এবং ক্যুবেক এলাকার প্রথম চার্চ ছিল। এরপরে একশ বছরে এখানে খ্রিষ্ট ধর্মানুসারীর সংখ্যা এতই বৃদ্ধি পায় যে – ভেতরে জায়গার অভাবে চার্চের নিয়মিত প্রার্থনায় সমবেত মানুষ চার্চের চারিদিকে খোলা জায়গায় দাঁড়িয়ে প্রার্থনা করতো । উল্লেখ্য, জায়গাটা কানাডা যেখানে মাইনাস ২০-৪০ ডিগ্রী বরফের মধ্যে তাঁরা এটি করতো।

পরবর্তীতে ১৮শ শতকের প্রথম দিকে চার্চ কর্তৃপক্ষ এটি বড় এবং নতুন করে করার সিদ্ধান্ত নেয়। নতুন চার্চটিই গত ২০০ বছর ধরে দাঁড়িয়ে আছে। অসম্ভব সুন্দর এবং জাকজমকপূর্ন চার্চের প্রতিটি নকশা। পুরো জায়গাটির সামগ্রিক এবং ইন্ডিডিভিজুয়াল ডিজাইনে সুগভীর চিন্তা, পরিকল্পনা এবং ধর্মীয় অনেক চেতনার সুনিপূন প্রকাশ দেখলে সত্যিই মুগ্ধ হতে হয়।

চার্চের হলরুমের সম্মুখভাগ

চার্চের হলরুমের সম্মুখভাগ

চার্চটির আর্কিটেকচারাল বিবরন দিতে গেলে লেখা অনেক বেশী লম্বা হয়ে যাবে। তাই এটির যিনি স্থপতি তাঁর সম্পর্কে একটু বলে শেষ করি –

নটর ডেম চার্চটি একটি রোমান ক্যাথলিক চার্চ। ১৮শ শতকে বানানো নতুন চার্চটির নকশা করেছিলেন জেমস ও’ডনেল নামের এক আইরিশ-আমেরিকান স্থপতি। তিনি ছিলেন একজন এঙ্গেলিকান। এঙ্গেলিকানিসম খ্রিষ্ট ধর্মের একটি চর্চার ধারা যা প্রটেস্টান চর্চার একটি উপধারা। তৎকালীন ক্যাথলিক কট্টরপন্থীতা আর ধর্মীয় গোত্রভেদের কারনে সে সময়ে একজন এঙ্গেলিকান একটি ক্যাথলিক চার্চ বানাবে এটা ছিল একরকম অকল্পনীয় ব্যাপার।

তবে, জেমস তাঁর সামর্থের পুরোটা ঢেলে দিয়ে, ধর্মীয় ভেদ পাশে রেখেই ক্যাথলিক অনুসারীদের জন্য এক অসম্ভব সুন্দর প্রার্থনালয় করে দিয়েছিলেন। তিনি চেয়েছিলেন যেন একজন প্রার্থনাকারী এই উপাসনালয়ে এসে যেন পরমাত্মার সাথে সংযুক্ত হতে পারে, হোক সে প্রার্থনাকারীরা ক্যাথলিক, খ্রিষ্টের অনুসারীই তো।

পুনর্নিমান শেষে এটি ছিল নর্থ আমেরিকার সর্ববৃহৎ চার্চ। জেমস চেয়েছিলেন যেন তাঁর সমাধি এই চার্চের ক্রিপ্ট বা চার্চের ভূগর্ভস্থ সমাধিকক্ষে দেয়া হয়। চেয়েছিলেন জীবনের সেরা সৃষ্টি কর্মের নিচেই সমাধিস্থ হতে। তবে যেহেতু তিনি এঙ্গেলিকান ছিলেন, ক্যাথলিক কর্তৃপক্ষ তাঁর এই অনুরোধ রাখতে অস্বীকৃতি জানায়।

নটর ডেম চার্চ তৈরী করতে করতেই একসময় জেমস শারীরিকভাবে অসুস্থ হতে থাকেন এবং মৃত্যুবরণ করেন। সবাইকে অবাক করে দিয়ে মৃত্যুবরণের আগে মৃত্যুশয্যায় তিনি ক্যাথলিক ধর্ম গ্রহন করেন। আর নটর ডেম বেসিলিকার মাটির নিচে একজনেরই কবর, যেটি জেমস ও’ডনেলের!

Computing Machinery and Intelligence by Alan Turing

This classic paper from 1950 was written by Alan Turing. This is where he first introduced the question “Can Machine Think?” and to answer that question he proposed “The Imitation Game”. The paper not only presents the computational or mathematical aspect of learning machine but also discusses theology, philosophy to telepathy and how can we start making this type of machine.

[slideshare id=122663772&doc=20181107tahsinaituring-181110155731]

Modeling Human Disease with iPSC

Induced Pluripotent Stem Cell (iPSC) has opened up new approaches in disease modeling, personalized medicine, cell therapy, regenerative medicine and so o. Here is my presentation slide on Human Disease modeling with iPS cell.

[slideshare id=120899379&doc=modelinghumandiseasewithipsc-extended-181027014907]

Helpful references:

  1. Ardhanareeswaran, K., Mariani, J., Coppola, G., Abyzov, A. & Vaccarino, F. M. Human induced pluripotent stem cells for modelling neurodevelopmental disorders. Nat. Rev. Neurol. 13, 265–278 (2017).
  2. Chen, Y.-W. et al. A three-dimensional model of human lung development and disease from pluripotent stem cells. Nat. Cell Biol. 19, 542–549 (2017).
  3. Dutta, D., Heo, I. & Clevers, H. Disease Modeling in Stem Cell-Derived 3D Organoid Systems. Trends Mol. Med. 23, 393–410 (2017).
  4. Ebert, A. D., Liang, P. & Wu, J. C. Induced pluripotent stem cells as a disease modeling and drug screening platform. J. Cardiovasc. Pharmacol. 60, 408–16 (2012).
  5. Kondo, T. et al. Modeling Alzheimer’s disease with iPSCs reveals stress phenotypes associated with intracellular Aβ and differential drug responsiveness. Cell Stem Cell 12, 487–96 (2013).
  6. Li, L., Chao, J. & Shi, Y. Modeling neurological diseases using iPSC-derived neural cells. Cell Tissue Res. 371, 143–151 (2018).
  7. Liu, C., Oikonomopoulos, A., Sayed, N. & Wu, J. C. Modeling human diseases with induced pluripotent stem cells: from 2D to 3D and beyond. Development 145, dev156166 (2018).
  8. Shaheen, N., Shiti, A. & Gepstein, L. Pluripotent Stem Cell-Based Platforms in Cardiac Disease Modeling and Drug Testing. Clin. Pharmacol. Ther. 102, 203–208 (2017).
  9. Shi, Y., Inoue, H., Wu, J. C. & Yamanaka, S. Induced pluripotent stem cell technology: a decade of progress. Nat. Rev. Drug Discov. 16, 115–130 (2017).
  10. Siller, R., Greenhough, S., Park, I.-H. & Sullivan, G. J. Modelling human disease with pluripotent stem cells. Curr. Gene Ther. 13, 99–110 (2013).
  11. Takahashi, K. et al. Induction of pluripotent stem cells from adult human fibroblasts by defined factors. Cell 131, 861–72 (2007).
  12. Takahashi, K. & Yamanaka, S. Induction of pluripotent stem cells from mouse embryonic and adult fibroblast cultures by defined factors. Cell 126, 663–76 (2006).
  13. Workman, M. J. et al. Engineered human pluripotent-stem-cell-derived intestinal tissues with a functional enteric nervous system. Nat. Med. 23, 49–59 (2017).
meena and zuckerberg
মীনা কার্টুনের দোকানদার ও এ যুগের জুকারবার্গেরা

ছোটবেলায় দেখা মীনা কার্টুনের একটা পর্ব ছিল এরকম — মীনা ও তার বাবা দোকানদারের কাছ থেকে ঋনস্বরূপ ৮০০ টাকা নিতে গেলে দোকানদার চুক্তিপত্রে ইচ্ছা করেই ১৮০০ টাকা লিখে অক্ষরজ্ঞানহীন মীনার বাবার কাছ থেকে টিপসই নেয়। তবে বুদ্ধিমতী এবং লেখাপড়া জানা মেয়ে মীনা লেখাটি পড়ে এবং বাবাকে দোকানদারের ইচ্ছাকৃত এই “ভুল” এর থেকে বাঁচায় (লিঙ্ক)।

তথ্য-প্রযুক্তির এ-যুগের দোকানদাররা “তথ্যের” দোকান খুলে বসেছে। ইন্টারনেট ব্যাবহারে যে বিষয়টি আমরা সবচেয়ে বেশী উপেক্ষা করি তা হচ্ছে এর “টার্মস এন্ড কন্ডিশন”। প্রযুক্তি ব্যাবসায়ীরাও এটা খুব ভালো ভাবে জানে এবং এর সুবিধা তারা সবসময়ই সচেতনভাবে নেয়। এমনকি জুকারবার্গ মার্কিন কংগ্রেসের সামনেও পাবলিকলি তা স্বীকার করেছে (স্বীকারোক্তি)।

এখন চিন্তা করে দেখুন আপনি কি শর্তে তাদের সার্ভিস ব্যাবহার করছেন তা আপনি নিজে জানছেন কি? মীনার বাবার মত অশিক্ষিত না হয়েও “প্রযুক্তি জ্ঞান” এবং সচেতনতার অভাবে এই প্রযুক্তি দোকানীরা নিয়ে যাচ্ছে আমাদের সর্বস্ব। এ ব্যাপারে আমি নিজেও অসচেতন ছিলাম। আগে “টার্মস এন্ড কন্ডিশন” কিংবা “প্রাইভেসি পলেসি” পড়তাম না। কিন্তু নিজে প্রযুক্তি অঙ্গিনার মানুষ হয়ে এগুলো না পড়ে “I Agree” বাটনে ক্লিক করাটা একসময় ওই মীনার বাবার মত কিছু না জেনেই টিপ-সই দেয়ার মত মনে হলো। এটাই ইগ্নোরেন্স। সচেতন হলাম।

আইনের দুর্বলতা

বর্তমান সময়ে সরকার নিয়ন্ত্রনের চাবি বেনীয়া বা ব্যাবসায়ী গোত্রের কাছে। ২০১৭ তে টাইম ম্যাগাজিনের রিপোর্ট অনুযায়ী, ৮২% সম্পদের মালিক ১০% লোক (পড়ুন) যারা ব্যাবসায়ী। নীতিনির্ধারনে এরা যা বলে তাই-ই হয়। উদাহরণস্বরূপ, যুক্তরাষ্ট্রে বছরের পরে বছর আগ্নেয়াস্ত্র নিয়ন্ত্রণ বা Gun Control করার সর্বস্তরের সামাজিক দাবি সত্ত্বেও অধিকাংশ রাজনীতিবিদ আগ্নেয়াস্ত্র ব্যাবসায়ীদের থেকে বিপুল পরিমান ফান্ড পান বলে রাজনীতিবিদদের এসব ব্যাবসায়ীদের কথাই শুনতে হচ্ছে এবং নিয়ন্ত্রণে আইন প্রণয়ন করছেন না। যার ফলাফল ২০১৮ সালের প্রায় প্রতিদিন গড়ে একটি করে mass shooting বা আগ্নেয়াস্ত্র ব্যাবহারে গনহত্যার মত ঘটনা সেখানে ঘটছে। এ বছর প্রথম ৬ মাসেই সেখানে প্রায় ৬,৫০০ লোক Gun Violance-এ নিহত হয়েছে যা 9/11-এর টুইন-টাওয়ারে জঙ্গি হামলায় নিহতের দ্বিগুনের বেশী (লিঙ্ক)। অথচ, এ ব্যাপারে আঈন প্রণয়নে সরকারের কোনো ধরণের কোনো উদ্যোগ বা পরিকল্পনা নেই। অতএব, বোঝাই যাচ্ছে ব্যাবসায়ী চক্রের হাত কত শক্ত।

ফেসবুক প্রায় ১৫ বছর ধরে আছে। ফেসবুক ব্যাবহারের ফলে কি পরমান সামাজিক অবক্ষয় এবং মানসিক অসুস্থতা হচ্ছে এবং হবে সে ব্যাপারে প্রায় এক দশক আগে থেকেই বিজ্ঞানীরা সচেতন করে আসছেন। তবে রাজনীতিবিদরা নড়ে-চড়ে বসল যখন তাদের নিজেদের স্বার্থে আঘাত আসতে শুরু করলো। এর আগে ফেসবুকের কারণে আত্মহত্যা, সাইবার বুলিং থেকে শুরু করে বিভিন্ন সামাজিক সমস্যায় তারা যখন চুপ ছিল, তারাই এখন সরব হয়ে উঠেছে গত কিছু বছরে ব্রেক্সিট (ইউরোপিয়ান ইউনিয়ন থেকে ব্রিটেনের বের হয়ে যাওয়ার ক্ষেত্রে সামাজিক যোগাযোগ মাধ্যমের ভূমিকা), ট্রাম্পের জয় এবং তাদের নির্বাচনে সামাজিক যোগাযোগ মাধ্যমের তথ্য ব্যাবহারের মাধ্যমে রাশিয়ার হস্তক্ষেপ, রোহিঙ্গাদের নিজ ভূমি হতে বিতারন সহ বিভিন্ন রাজনৈতিক স্বার্থে আঘাত আসার পরে।

অতএব, যদি মনে করে থাকেন যে এসব প্রযুক্তি মাফিয়ারা কিংবা সরকার আমাদের স্বার্থের কথা চিন্তা করে নিজেরা নিজেদের নিয়ন্ত্রণ করবে, ধারণাটি ভুল। আমাদের ভালোটা, আমাদের নিজেদের মাথা খাটিয়েই বুঝে নিতে হবে। আর সেটি করতে হবে, চিন্তা শক্তি কেড়ে নেয়ার আগেই।

শেষ কথা

পবিত্র কোরআনে মদের ব্যাপারে বলতে গিয়ে আল্লাহ বলছেন,

“লোকজন মদ ও জুয়া সম্পর্কে তোমাকে জিজ্ঞেস করছে। বলো, ‘দুটোই গুরুতর ক্ষতিকারক। ওতে কিছু কিছু উপকারও আছে। তবে উপকারের চেয়ে ক্ষতির পরিমাণ অনেক অনেক বেশি।’ (বাকারা ২১৯)”

আয়াতটি নিয়ে চিন্তা করতে করতেই মনে হলো – ফেসবুক বা সামাজিক যোগাযোগ মাধ্যমও এই মদ/জুয়ার মতই। মানুষকে আসক্ত করে তোলে। একটা সময় ফেসবুক ব্যাবহার বন্ধ/কন্ট্রোল করতে চাইলেও মানুষ তা আর পারে না। উল্লেখ্য, ফেসবুক মানুষকে আসক্ত রাখতে লাস ভেগাসের ক্যাসিনো বা জুয়াঘরগুলোতে মানুষকে আসক্ত করে তোলার টেকনিকগুলো সফলতার সাথে ব্যাবহার করে আসছে; তারা নিয়োগ দেয় সেখানকার আসক্তি বিশেষজ্ঞদের (লিঙ্ক)। কোরআন এর আয়াতটি থেকেই বলতে চাই, ফেসবুক বা সামাজিক যোগাযোগের যে ভালো দিক নেই তা নয়। তবে এর ভালো দিকের চেয়ে ব্যাক্তিগত, পারিবারিক, সামাজিক, রাস্ট্রীয় এবং পুরো পৃথিবীর মানুষের জন্য সামগ্রিকভাবে এর ক্ষতির পরিমাণ অনেক… অনেক বেশি।

তাই আসুন, সচেতন হই। ফেসবুক, সামাজিক যোগাযোগ মাধ্যম ব্যবহার বন্ধ করি। ইন্টারনেট ব্যাবহারের ক্ষেত্রে নিজে জানি যে কি ব্যাবহার করছি। নিজে না বুঝলে মীনার মত বুঝদার কারো সাহায্য নেই বোঝার জন্য। তবে অন্ধের মত অর্থলোভী দোকানদারের কাছে যেন আমরা নিজেদের না বিকিয়ে দেই। বিকিয়ে দিলে কখন আমরা ট্রাম্পের মত কাউকে নির্বাচিত করবো, কিংবা রোহিঙ্গাদের মত নিজেদের ঘড়ছাড়া হয়ে যাবো তা আমরা নিজেরাও টের পাবো না। নিজেদের ব্যাক্তিগত ও পারিবারিক জীবনে পিছিয়ে পরা এবং অশান্তি তো আছেই।

[“ভার্চুয়াল ভাইরাসের” উপরে বিভিন্ন অনুষ্ঠানে প্রদানকৃত বক্তব্য হতে সংকলিত – পর্ব ১]

Does Result Really Matter?

Bad results put you behind when you start your next race

Bad results place you behind when you start professional/academic race

Once a sprinter was competing with nine other sprinters in a 100-meter race. But when he entered the arena, he saw – while everyone starting from the same mark, he was marked to starting from 20 meters behind others. After asking the referee the reason, referee replied, “Because your previous race result was not as good as others. So you will start behind others.”

It may sound funny, but that is the reality in the real-life race. This is how you get behind of others while seeking for a job or looking for an admission in next level of education. Nevertheless, you can still win the race only if you can run unimaginably faster than others in that short time. You have to do extra hard work as a remedy for your past negligence. However, I see a lot of students with an average result with no significant or economic skill at all. How can you expect someone hiring you? Besides, I have seen that educated people become better CEOs and businessman than others in most cases.

Misconception
“Motivational Speakers” often say that “result does not matter.” which I find misleading and I strongly disagree with the statement. I think the “result does not matter” notion is correct as long as you have “done your part best.” You have tried to get a good result yet you failed for some reason that is beyond your control.
As a student, I am mediocre. I was never in top 25% in the merit list in my school/college life. Even I failed quite a few times. Although the scenario changed during my university life. So, I know how an “F” student thinks, how a mediocre student’s view differs and how a top student perceives education. Most importantly, I know how to transit between this thought process.
Most of the “F” students see education as an unnecessary burden. On the other hand, toppers realize that education is a system which pushes us through a process of learning. We may have forgotten most of the things. But it is the process which is precious. It is the thought process that put barriers between good student and failed student.
In Conclusion

Run Forrest Run

“Run Forrest Run” Movie: Forrest Gump

If you think the result is everything and employers care about your result, you are wrong. Although result will set you at the advantageous mark on the race, still, you have to run with your full effort to qualify for next stage. The only value of your result to the employer is – you know the art of learning and the benefits it possesses.

On the contrary, if you think result does not matter, then you will end up behind the mark. You may not have the opportunity to win because of your ignorance. Besides, you never entered the “process of learning”.

So, try your best to learn and have a good result. Also, create your skill set by applying your learning through volunteering, part-time job, freelancing, hobbies or any way possible.

How I learn new Framework/Language/Library/Tools

Frameworks come-and-go. There’s nothing you can do. But one thing you can do is – adapt. And if you don’t, you’ll be forgotten like your framework/tools. Most of us fear new stuff. We fear change. Adaptation is very easy if you can overcome the fear of it. It is not only true for the framework but also for programming languages/libraries/tools etc. I will refer all these together as “X” in this writing.

Step 1: Quick Start
My first step is to read and to go through quick start/first step guide. Generally, all major official documentation provide this type of quick start guideline which also includes example code. I start implementing (coding) right away with a small application that pops up into my head at that moment and tries out some features of the X.
Doing this gives me an idea of X am trying to learn. Moreover, it gives me confidence that I am “making” things with this new X. I am like – “WOW!!! Cool it is working!” which eventually helps me to go forward. It takes me a couple of hours to get familiar with the X.

Step 2: Dive In
After spending a couple of hours of basic quick start, I START DOING real project/task…

I do not try to learn everything before I start. While following quick start guide, I try to understand why and what am doing each thing mentioned there. I do not write any single character of code that I do not understand. I think it is one of the essential things. Initially, I do not copy paste code, instead try to write, reason and modify it as I go.

Additional Tips:
Follow Convention: I’m very strict about the convention and best practices. Hence, I read and follow their best practices and convention guideline as I start coding. However, that does not mean that you should never go off the book. But that should be very rare and exceptional case, and you will know when you have to do that.

Read Documentation: I read official documentation. It becomes my bible while I code. I try not to watch video tutorials. To my observation, tutorial helps you to learn quickly and easily but kills your technical reading capability. It affects severely when you try to develop advanced stuff since that advanced stuff is not available in tutorials. On the other hand, if you are familiar with the documentation, you will be able to figure out how to do that or where to look at for that. You will know how to use resources like Google search, stack overflow and online articles quickly when you are stuck.

To sum up, I do not restrict myself to any language/framework/tools/library. I try to adapt, and I feel these tricks help me to set off efficiently.

Lastly, one of the keys to Apple Inc.’s success is – adaptation. They not only adapt but also frequently kill their own popular product and present newer one. Apple killed their Macintosh, killed iPod, even killed headphone port! Here is a video from PolyMatter which describes this matter quite adequately. They know – technological changes are inevitable. So, they bring the changes themselves instead of following the trends. They become the trendsetter and not the trend follower.

languages

Lung-Cancer-3
Can Machine Learning Really Detect Lung Cancer?

“Artificial Intelligence (AI)” – a topic that is so intriguing throughout last decade that even Elon Musk and Mark Zuckerberg debated over recently. Key integral part of an AI is Machine Learning (ML) which allows a machine to learn how we want them to think. Although it has been almost fifty years since ML and related research work existed, we started exploring its diverse potential to solve many of human problems in this 21st century. One of its blessing we have got so far is in the area of bioinformatics.

Severity of Cancer Diagnosis

Every cancer is unique in its own way. Despite the fact, researchers are continuously trying to identify the causality to make prevention possible. Furthermore, detection of cancer is as important as prevention. Because early diagnosis of cancer shows a higher chance of survival. For instance, a lung cancer patient with localized cancer has 55% survival rate whereas if the tumor spreads to other organ chance drops to 4%. However, only 16% of lung cancer cases are diagnosed at an early stage. Moreover, in 2014, almost 14.5 million people in the US was beyond the reach of cancer diagnosis. Rest of the world especially underdeveloped and developing countries lack more behind in having such facilities.  Reason behinds this includes the necessity of high-quality equipment and expert physicians to diagnose cancer. This is why researchers are trying to incorporate AI and ML algorithms to make the diagnosis process simpler with remarkable accuracy.

Recent Development Through ML

In 2017, Kaggle, most popular data science learning and competition platform hosted Data Science Bowl featuring cancer diagnosis problem. Open sourcing CT scan images to the public, it asked data scientists to come up with a machine learning model that better predicts the probability of lung cancer. In return, Kaggle offered its highest prize money to this date valued one million US dollar. It was three months long competition from February 2017 to April 2017 where almost two thousand teams across the globe participated. After finishing the competition, a new initiative  Concept To Clinic is being taken to develop an open source solution for clinics. This system will enable radiologists to access the solution developed by the researchers through SAAS. Concept To Clinic is funded by The Bonnie J. Addario Lung Cancer Foundation which aim is to make lung cancer a chronically managed disease by next five years. Targeting this challenging vision, development of the system has already begun and has been open sourced on the first week of August 2017 for engineers and data scientists. This initiative also offers monetary rewards based on the contribution one makes. Total prize money valued 100,000 US dollar is announced for top contributors.

Behind The Scene

Detection of lung cancer happens in two major steps: 1) creating ML model and 2) using the model to predict the cancerous region of lungs. To create or train an ML model, researcher feed-in CT scan DICOM image files along with attributes such as tumor size, malignancy information. Using that information normal or irrelevant regions are ignored. To rectify abnormal regions, an ensemble of multiple statistical models are used. This model is checked and cross-validated on test data which is not used in training. Upon successful development of the model and satisfiable accuracy, it is used to predict the probability of cancer tumor.

How It Impacts Human Race

According to SEER report, Lung cancer is the deadliest cancer which kills more people than breast, colon, and prostate cancer combined. Every 3.3 minutes someone in the U.S. dies of lung cancer. Currently, CT scan which is a 3D image of lungs is used to detect possible cancerous regions. These scans are then carefully observed by trained radiologists. This procedure not only requires expert eyes but also labs with proper equipment. Nonetheless, it results in high false-positive detection; people with no cancer may be treated for cancer unnecessarily which is not only an economical burden but also psychologically stressful for both the patient and his/her family.

Prediction through ML can make this diagnosis process much simpler and reliable. Although statistics of current cancer diagnosis is making health experts upset, results from research and development in this area are showing lights of hope.

bioinformatics in dna
My First Step towards Bioinformatics

Bioinformatics is a rising area which combines multiple discipline including Biology, Computer Science, Psychology, Mathematics and Statistics, Chemistry.

I have a keen interest in Biological Science. I had courses in high school in Biology and I did quite well there. But when I had to choose my undergrad major I chose Computer Science as I have more interest in it. We did not have graduation degree on Bioinformatics in our country. To be frank, I did not plan to move to Bioinformatics in my undergrad life as well. My target was to learn as much knowledge as possible in diverse area of Computer Science. When I was exposed to AI, Machine Learning I decided to do MS in this topic. As a consequence, I decided to do major in Intelligent System in my MS. During MS I started to develop interest in Bioinformatics.

Since there were no courses related to Biological Science or Bioinformatics directly, I started to read on my own. I started with Human Cognition and development of AI cognition. TV series Westworld encouraged me in this particular case. Eventually I searched a lot of content on google. Among them there was a list of Cognitive AI projects on Wikipedia. Additionally, it contains other interesting projects in AI. Among the projects OpenCog interested me. It seemed a nice framework designed to develop AI systems.

One day I was reading some articles on attributes which defines and control human psychology. I tried to understand functionality of hormones like Estrogen, Testosterone, Serotonin and so on which are responsible for various activity in our body and mind how various hormones are controlled by our Endocrine System. During that time, I found some competitions on Kaggle which required to solve problem related with various type of Cancer by the help of machine learning and neural network problem. I was not well equipped with the knowledge required to solve those problem. I knew ML and NN algos but I felt that if I know more about those problem, it may allow me to discover more interesting research problem that exists in current world.

Following my curious mind, I started digging about cancer and cancer mutation. I started reading about our primal components like DNA, RNA and proteins. I tried to understand how mutation works and when it fails, how cancer cell affects normal mutation. I will try to write a separate article regarding cancer genomics in future and some interesting aspect that fascinated me including the resources that helped me.

Forecasting from Times Series model using Python

Playing with large set of data is always fun if you know how to do it. You can fetch interesting information from it. As part of my Master’s course I have had opportunity to work on forecasting using Times Series modeling. And yes, now I can predict future without being a clairvoyant. 😀

Considering popularity of R in Data Science, I started with R. But soon I realized it has learning curve. So, I opt out for Python. I am not going to write R vs Python because it is already written nicely here in DataCamp’s blog.

So, let’s get started. Time series models are very useful models when data points collected at constant time intervals. This time series stationarity is main per-requisite for the dataset. Until unless your time series is stationary, you cannot build a time series model. There is a popular example named “Random Walk”. The summary of the example is prediction becomes more inaccurate as input data is randomize.

We will use two completely different dataset to for prediction.

  • Nile Water Level between AD 622 to AD 1284. Get it here
  • Air Quality data of Italy taken on Hourly basis. Get it here

The reason we are taking two different model because we want to show multiple different Time Series models.

ARMA:

ARMA is basically combination of two different time series model AR and MA. AR stands for Auto Regressive and MA stands for Moving Average. In ARMA we work with single dependent variable indexed by time. This method is extremely helpful when we do not have any other data than time and one specific type of data. For example in case of Nile data we only have the water level data which is indexed by time(year). I am giving you warning, if your data is not stationary you will be tearing off all of your hair to fit the model. So, make sure your data is consistent to save your hair.

We have used Pandas for Data management.

We have used StatsModels ARMA method for prediction. It takes an mandatory parameter order which defines two parameters p,q of ARMA model. p is the order for AR model and MA is for MA model. Full API reference for this function can be found here. StatsModels also provides ARIMA modeling. In case of ARIMA model we just have to pass difference order parameter.

The predictors depend on the parameters (p,d,q) of the model. Here is the short description about it.

  1. Number of AR (Auto-Regressive) terms (p): AR terms are just lags of a dependent variable. For example if p is 5, the predictors for x(t) will be x(t-1)….x(t-5).
  2. Number of MA (Moving Average) terms (q): MA terms are lagged forecast errors in prediction equation. For example if q is 5, the predictors for x(t) will be e(t-1)….e(t-5) where e(i) is the difference between the moving average at the ith instant and actual value.
  3. Number of Differences (d): These are the number of nonseasonal differences, i.e. in this case we took the first order difference. So either we can pass that variable and put d=0 or pass the original variable and put d=1. Both will generate same results.

To calculate p and q I have run Autocorrelation Function (ACF) and Partial Autocorrelation Function (PACF). StatsModels have acf and pacf function to do this for us.

How I have done it:

At first, I have installed Anaconda to get everything I need. Yes. we have gathered the whole zoo to do our data science. Python, Pandas and now Anaconda. Don’t forget you can write your code in IDE named Spider. Whatever…

 

After that, I have used Pandas to read CSV. At first I was trying to fit ARMA on Air data. But since it was hourly data, fitting those data was difficult. Then I moved to Nile data. I was having hard time fitting Nile data because the time span for the data was out of the range of supported timestamp. So, instead of using DateTime index I switched to period range of Pandas. I have generated custom period range to support the time range. The while fitting ARMA model I passed the dates generated by the period range with annual frequency. For p and q order I have used ACF and PACF. I have calculated the lags and then plot it on a graph with bounds.

ACA and PACA observation

ACA and PACA observation

Observing the graph I have taken (2,2) as (p,q) order. After fitting the model I have predicted using the model. Here is the output of the prediction:

Nile Water level prediction

Nile Water level prediction

 

Linear Regression & Random Forrest Regression:

Besides ARMA and ARIMA model we have tried to use other prediction model. One of them are Linear Regression. SciKitLearn provides handful methods to do Linear Regression and Random Forrest Regression. I have ran these models on Air Quality data and got very good output. It has been observed that Random Forrest Regression generates more accurate predictions than Linear Regression. Random Forrest Regression has error rate of 12.8169340263% where as Linear Regression generates output with error rate 29.8718180357%.

 

How I have done it:

After reading data from CSV using pandas I have dropped NA(not available) or null values. Then I have omitted extreme values. I have run a co-relation calculation with all the columns against Temperature. The output was following:

Corelation with Temperature

Correlation with Temperature

Then I have run prediction model on on the data. I have considered Temperature “T” as the dependent variable and others as the independent variable. The output was following:

Random forrest

Random forest

 

Here is the code for everything I described above.

Dynamic form field based on another model’s entries and save them in a m2m way in Django

It’s been a while since I have done this type of brain storming stuff. Today is my country’s victory day and I have got some free time.

Objective:

I have a inventory model named Item. An item can have many attributes such as height, width etc. Think about a system where more attributes can be added in future. I wanted to build such a system where I can dynamically add these attributes so that I don’t need to modify my  model or code for this type of changes.

The idea:

The idea is very simple. I will have 3 models.

  • Item
  • Attribute
  • ItemAttribute

Item model will hold basic information about the item. In Attribute model I can add as many attribute as I wish. This model will have a type field which will determine the type of each attribute such as text, choice, number etc. It is possible to add more fields like length, required etc and add business logic for these. But for keep it simple for now.

ItemAttribute is the many to many relational table between Item and Attribute. It will have an extra field called value to store the value of this attribute.

In short: Item has many Attribute. Each of which has a value. To facilitate this we need many to many (m2m) relation between Item and Attribute.

How it is done:

Here is the gist how I achieved this functionality.

image manipulation with cache facility in nginx

Manipulation like resizing to cropping, rotating an image is very easy through image_filter module of nginx. In addition we can cache this manipulated images.

We will need 2 nginx server.

  1. original server [ i,e, http://mysite.local:80 ]
  2. media server. [ i,e, http://media.local:80 ] This server will be used to deliver the desired resized or cropped images.

Here is the configuration for the servers:

IntelliJ IDEA + Phonegap + Android SDK + Genymotion + linux

It is bit tricky to do this all together. Let me give me a overview why I choose these tools .

  • IntelliJ IDEA is an IDE I love working on. Actually for all of my developing purpose I use Jetbrain’s Product. PhpStorm, PyCharm, WebStorm. Since, it is not targeted for native android development choosing Android Studio is not necessary. I use that for native as it. Currently, I am using latest version – v14.
  • Phonegap is being used as I need to develop hybrid app. Android SDK is needed for deployment in android platform. I am using version 5.1.
  • You may ask why Genymotion in lieu of AVD. The answer is, Genymotion seems faster to me. If you have already use AVD, it is not important how high end machine you use, I am sure you are very annoyed when you try to emulate. Genymotion may reduce your anger to some extent.
  • Linux: seriously?? You are going to ask me why linux??

How to:

Downloads & Installations:

  1. To use phonegap make sure you have node.js and npm installed in you system. Then run following command.

    $ sudo npm install -g phonegap

  2. Download android SDK. Extract it to the folder where you want to install it. Lets say it is the “home” folder. ~/android-sdk-linux Add ~/android-sdk-linux/tools and ~/android-sdk-linux/platform-tools to your path variable.
  3. Run $ andoird and download necessary libraries and API.
  4. Download genymotion and install it and install it buy running the .bin file.
  5.  Download IntelliJ IDEA. Extract it to the folder where you want to install it. Lets say it is the “home” folder
  6. run $ bin/idea.sh (make sure it is executable) and follow the installation process.

Setting Up:

  1. Install “Genymotion” and “Phonegap/Cordova” plugin. To install it, go to Settings → Plugins → Install JetBrains plugin…, then select PhoneGap/Cordova Plugin and click Install plugin. Same goes for genymotion.
  2. Create a new project using Web Static → Phonegap/Cordova category.
  3. after project creating the project open Project Structure (ctrl+shift+alt+s) in SDK add JDK library then Android SDK.
  4. On same window (Project Structure) select Modules. Click on (+) → import module. Select android folder under platform folder. and  click next. Important note that, do not import debug folders. When folder selection screen comes, select all folders (eg: ../android and all ../gen and ../src folder) except debug folders.
  5. Open Run/Debug Configuration.Click (+) → Android Application. Select then module you imported earlier. In Target Device select “Show Chooser Dialog” option.
  6. Run Genymotion and start your device.
  7. Run this newly created android configuration instead of Phonegap run and you will see your app running on your genymotion device.

Known Issue:

  • No module in step 5 ?
    – Make sure you have imported the module properly as described in step 4.
  • Errors on importing module ?
    – Follow the instruction carefully. May be you have added debug folders too.
Solution of infinite digest loop for ng-repeat with object property filter in AngularJS

Few months ago I wrote a code in AngularJS which was something like this:


<ul ng-repeat="course in courses|filter:{is_taken:true }" >
<li>{{ course.name }}</li>
</ul>

 

It was generating a digesting loop error. Though the data was showing correctly. Soon I realized that it was generating because for each turn in ng-repeat loop, courses are filtered up. So, it was watched and digest by default characteristics of angular Scope. In this situation the easiest solution to me was following:


<div ng-init="filteredCourses=courses|filter:{is_taken:true }">
<ul ng-repeat="course infilteredCourses" >
<li>{{ course.name }}</li>
</ul>
</div>

 

What I did was I initiated a new object using ng-init which contains the filtered objects. Then use that newly created object to loop on. And all those errors are gone… 🙂

AJAX requests in CakePHP without disabling SecurityComponent

Security is always a big deal for a software specially for web app where you don’t know your users’ intention. To ensure some common security measure, CakePHP provides SecurityComponent with its core.

Let’s come to the point. If you try to POST any request through AJAX, you will get Bad Request exception and your request will be Black Holed.

So, how do you prevent this without disabling the SecurityComponent for the action(many online resources do this. But this is not what we want, right?)? Well, you need to do 2 things to do in your beforeFilter to achieve that.

$this->action == 'add') {
    $this->Security->csrfUseOnce = false; // We will use CSRF token for more than one time
    $this->Security->validatePost = false; // Disabling form POST validation
}

Why these two:

  1. Since we may do the request several time from different parts of a single page, we will use same CSRF token. Though there is a complex way to update CSRF token of the page after the ajax request processed, but lets stick with the easier way.
  2. Also, SecurityComponent require you create your form using FormHelper shipped with CakePHP core. I’m assuming the form is not built with the FormHelper. You can ignore this if you generate your form using FormHelper.

If you do not using FormHelper to ensure CSRF protection you will need to post CSRF token with your post data in specific format. Here is how the CSRF token should be in post data.

array( 
'_Token' => array(
    'key'=> $this->Session->read('_Token.key');
    ),
'ModelName' => array(
    // modeldata
    )
)
PHP Image Manipulation

GD library (http://php.net/manual/en/book.image.php) is a good PHP library for manipulating images. I was familiar with it but never used in production before. I’m working on a personal project now which required some image manipulation for profile image (avatar). So, I used GD library and it’s really easy to use.

If you are using latest version of XAMPP, GD library is already included and activated. You don’t need to set up anything. Just start coding. Though php.net has the manual how to install GD library. If you are interested, you can see that. The manual contains almost everything you need to complete your task. You can resize, create, copy, crop and many more manipulation. I enjoyed using this. I hope it will help you too.

If you want you can use imagick (aka: ImageMagick). This extesnion has some advanced options. But many online server does not support imagick. But this extension is awesome too and will full-fill almsot everything you need to tweak you images.

2012

This year was tremendous for me. It was a successful year for me. I have also broken down some of my barrier. I’m sharing here some of these here. But at first I want to thank God for giving me such a wonderful year.

Varsity life:

I started my university life on 15th January. I’ve passed a wonderful year there maintaining a good CGPA. Got some new friends there. Yesterday I got my 3rd semester result and it is 4 out of four. So, I’m finishing the year with CGPA 3.87.

Professional life:

Officially I started my professional life in this year on March. My first project was a php project for an e-commerce website. I was hired through oDesk. It was a great experience. Followed by I was hired by an US company as an executive assistant and Drupal developer. Besides this I’m working as an Web developer in a local company. I’ve completed a government project with them. Then I started working with an Italian company as a cakephp developer. I’m still working with them. In the meantime I got some good job offer. But unfortunately I decided not to accept those offers to continue my personal learning.

Foundation life:

Many of you may know that I am a member of Quantum Foundation. Personally I’m not happy with my involvement this year. I should have given a bit more time there. But I’m happy to continue my regular meditation. This year I didn’t miss meditation for a day. Also I’m happy to continue my regular prayer. I got certification in Public Speaking this year from Quantum Foundation.

Misc. Facts of this Year:

  • I bought HP pavilion dv7 Notebook which cost 85,000 Tk. 60% of the money paid by myself and rest of the money from my family.
  • Bought Sony Xperia Ray with my own earning.
  • A year without playing computer game !!!! 😮 How I did this. OMG. I’ve just noticed it.
  • Launched my website officially with domain name http://www.tahsinrahit.com
  • Learned and learning : Android Developing, CakePHP, advanced C++, advanced PHP, advanced JAVA
  • Created a 2D cricket game using C++ all alone. It was a great experience. Enjoyed working on this.
  • And guys guess what… I started blogging this year. 😉

These are the things that come to my mind now about 2012. Wishing a very happy new year to all of you. See you next year. Good bye 2012…

Making Game using SDL: Part – 2

 

Welcome back guys. Let’s resume my last post which was Making Game using SDL: Part – 1. We discussed the variables of Graphics class. Now let’s see what functions we have used.

Graphics() Constructor:

Graphics::Graphics(){
SDL_Init( SDL_INIT_EVERYTHING );
//Set up the screen
this->screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
//Initialize SDL_ttf
TTF_Init();
//Set the window caption
SDL_WM_SetCaption( "rCricket2013", NULL );
this->textColor.b = 255; this->textColor.g = 255; this->textColor.r = 255;
}

In constructor we will initialize everything to create a screen. To use SDL, we need to first call SDL_Init(). Then what we are doing is setting up properties for a screen. We are passing the values of SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP from our global values and SDL_SWSURFACE from default SDL value. You must remember that I mentioned in my previous post that everything that has SDL_ prefix is actually comming from the SDL library. So, in this case, value of SDL_SWSURFACE is also defined in SDL library.

Next, we are initializing True Type Font (TTF) by calling TTF_Init() , Since, beside graphics, we want to use Textual representation in our game. In line 8 we are setting up caption for the window and in my case I put the name of my game. At line number 9, we are setting up default font color.

load_image():

SDL_Surface *Graphics::load_image( string filename )
{
//The image that's loaded
SDL_Surface* loadedImage = NULL;

//The optimized surface that will be used
SDL_Surface* optimizedImage = NULL;

//Load the image
loadedImage = IMG_Load( filename.c_str() );

//If the image loaded
if( loadedImage != NULL )
{
//Create an optimized surface
optimizedImage = SDL_DisplayFormat( loadedImage );

//Free the old surface
SDL_FreeSurface( loadedImage );

//If the surface was optimized
if( optimizedImage != NULL )
{
//Color key surface
//Reference : http://www.colorhexa.com/ca18df
SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0xca, 0x18, 0xdf ) );
}
}
//Return the optimized surface
return optimizedImage;
}

In this function we are passing an image file and after necessary modification we are returning it. We need to do this modification to make the image compatible for our screen. I hope, if you read the comments in the code and try to do some research on each of the function and strategy we used here by reading the documentation, you will understand it.

apply_surface():

void Graphics::apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip){
//Holds offsets
SDL_Rect offset;

//Get offsets
offset.x = x;
offset.y = y;

//Blit
SDL_BlitSurface( source, clip, destination, &offset );
}

This may be bit complex to understand. What we are trying to do here, take the x and y co-ordinate of screen then just put the source surface on screen. This is pretty much of it. But if you want to know what’s going on in the back, here it is: we take a single surface as source. It can be *location or *text. and then we put it to our destination surface. Most of the time which is *screen. I think you remember what I said about *screen, *location and *text.

~Graphics() destructor:

Graphics::~Graphics(){
//Freeing Surface
for(int i = 0; i location_flag; i++){
if(this->screenBackgrounds[i].location){
SDL_FreeSurface(this->screenBackgrounds[i].location);
}
}
for(int i = 0; i text_flag; i++){
if(this->screenMessages[i].text){
SDL_FreeSurface(this->screenMessages[i].text);
}
}
}

In destructor, we will free the surface so that we don’t need to free it explicitly. You know, we stored the backgrounds and Texts in two different array. So, we are running two different loops to take each one of those and free them up. Here we run the loop 0 to the the flag that mention the top of the array. It’s because we don’t need to free the full array. We are freeing each surface by calling SDL_FreeSurface() function.

 

Screen Class

Now, let’s talk about Screen class. Screen class will be used to generate a screen. Important thing is, it’ll be inherited from the class Graphics. We actually won’t use properties of Graphics class directly. We will use it only in Screen class. Let’s see the class definition.

class Screen :
public Graphics
{
public:
//The font that's going to be used
TTF_Font *font;

Screen(string, int);
bool load_background( int x = 0, int y = 0, string location = "resources/background.png");
bool load_message(int x = 0, int y = 0, string text = "" );
bool trigger_surface();
};

Here, we see only one pointer variable of type TTF_Font. If you are thinking that this pointer will point the textual properties of a screen, you are absolutely correct. Let’s take a look at the functions.

Screen() constructor:

Screen::Screen(string font_file = "resources/BuxtonSketch.ttf", int font_size = 20){
for(int i = 0; i screenBackgrounds[i].location = NULL;
this->screenMessages[i].text = NULL;
}
this->location_flag = 0;
this->text_flag = 0;
this->font = TTF_OpenFont( font_file.c_str(), font_size );
}

Here we are preparing the arrays that we described in Graphics class by putting NULL value for location. Also we are initializing flag by point it to the index number 0. and at last we are initializing *font that we described earlier by using the values from arguments. First argument is indicating the font file and second pointer is defining size of the text in pixel.

load_background() & load_message():

bool Screen::load_background( int x , int y , string location , int w , int h ){
//Load the background image
this->screenBackgrounds[this->location_flag].location = this->load_image( location.c_str());
this->screenBackgrounds[this->location_flag].location_x = x;
this->screenBackgrounds[this->location_flag].location_y = y;
this->location_flag++;
return true;
}

bool Screen::load_message( int x , int y , string text , int w , int h ){
//Load the background image
this->screenMessages[this->text_flag].text = TTF_RenderText_Solid( this->font, text.c_str(), this->textColor );
this->screenMessages[this->text_flag].text_x = x;
this->screenMessages[this->text_flag].text_y = y;
this->text_flag++;
return true;
}

Both of these are pretty much same. 1st one is loading or putting an image to the screenBackgrounds array and 2nd one is loading or putting text in screenMessages array. we are also increasing flag value by one. We are using the optimized image that we get from the load_image() function of Graphics class to save it in *location.

trigger_screen():

bool Screen::trigger_surface(){
for(int i = 0; i location_flag; i++){
if(this->screenBackgrounds[i].location != NULL){
this->apply_surface(this->screenBackgrounds[i].location_x, this->screenBackgrounds[i].location_y, this->screenBackgrounds[i].location, this->screen, NULL );
}
}
for(int i = 0; i text_flag; i++){
if(this->screenMessages[i].text != NULL){
this->apply_surface(this->screenMessages[i].text_x, this->screenMessages[i].text_y, this->screenMessages[i].text, this->screen, NULL );
}
}

SDL_Flip( this->screen );
return true;
}

This function will just loop through those two array and trigger/apply it by using the app_surface function defined in Graphics class.

 

So, that’s all of Screen class. In our next part we will start constructing our game. Till now we just configured necessary functions to create screens and graphics. We will start implementing these in our next part. Before that, try to understand what these functions and variables will do. Hope, you will be clear when you see the implementation. Thanks you all. Bye bye…

 

 

Making Game using SDL: Part – 1

Few days ago I started to develop a cricket game for one of my university courses. I decided to use SDL Library to make the game. Since I wanted to develop a very basic 2D Game in C++, so I didn’t go for OpenGL or DirectX. SDL will provide almost everything to make this game. Besides this, SDL also have functionality to use OpenGL. That’s why I went for SDL Library. So, I started to learn SDL and start working. I’m sharing here how I’m making this game using SDL.

Lazyfoo has an wonderful resource for beginners in SDL. I’ve used MS Visual Studio 2012. Click here to see how to include SDL Library in various platforms. After inclusion, I’ve spent a day to try and learn how SDL Library work and it’s basic functionalists.You can take a look at those tutorials also.

Planning:

At night I designed the basic structure and functionalists of my game. Here what came to my mind that time.

Classes:

  • Graphics
  • Screen
  • Game
  • Events
  • Teams
  • GameEngine

 

Game flow:

  1. Welcome Screen
  2. Team and Game Setting Selection
  3. Toss
  4. Game Info display and wait for User confirmation
  5. Start Game

Game will have following functionality:

  1. Pitch pointing for bowling
  2. Shot selection for batting
  3. Running between wickets on user input
  4. Basic functions of a cricket game
  5. Batsman shot success will depend on difference between his Rating point & bowlers Rating point, shot selection for a particular delivery.

Obviously there will be some changes in this plan during the development process.

Coding:

I started coding from the following day. At first I created a class named graphics to hold all graphical properties. Today I’m going to describe only this class.

The main purpose of this class to hold the functions and variables to generate a Screen. We will see the Screen class later on. Let’s just see what I put in the Graphics class. Here what variables and functions I will have in that class .


class Graphics{
public:
//The color of the font
SDL_Color textColor;

//The surfaces
background screenBackgrounds[MAX_SCREEN_ELEMENT];
message screenMessages[MAX_SCREEN_ELEMENT];
int location_flag ;
int text_flag ;

SDL_Surface *screen;

Graphics();
~Graphics();
SDL_Surface *load_image(string);
void apply_surface( int, int, SDL_Surface*, SDL_Surface*, SDL_Rect* clip = NULL );

};

Initially I planned to put everything under public access. I know it’s not a good idea. But, since I’m new to SDL and trying to develop a game, so I wanted to avoid complexity. I’ll place them in private and protected after I finish the main coding.

Let’s take a look at the class in depth. To set text color of a particular screen, I declared a textColor variable. Note that, all variable type, started with SDL_ you will see in this project are form SDL library. So for detail reference of them please take a look at SDL Documentation .

We will have two types of thing in a single screen. images/pictures/backgrounds and text. So here we defined an array of background type to contain images for a single screen and another array of message type to contain text/messages for a single screen. background and message are just two structure. Here are those two structure…

struct background
{
SDL_Surface *location;
int location_x;
int location_y;
};

struct message
{
SDL_Surface *text;
int text_x;
int text_y;
};

So, here you see, values for each. For background, 1st one is for having the location of the image file and for message, 1st one is for holding the text. both location_x and text_x are to store the position in X-co-ordinate of that particular image or text and location_y and text_y are to store position in Y-Co-ordinate of the window. By the way, our window width and height will be 1024×768. This values are defined as global constant including the value of MAX_SCREEN_ELEMENT, which you’ve seen as the array length. Here is the code.


//Screen attributes
const int SCREEN_WIDTH = 1024;
const int SCREEN_HEIGHT = 768;
const int SCREEN_BPP = 16;
const int MAX_SCREEN_ELEMENT = 100;

You may wonder to see SCREEN_BPP. It’s screen bit per pixel. We will use this value soon. Next, the location_flag Difference between screensand text_flag are to flag top index of the array screenBackgrounds and screenMessagespointer *screen will actually hold the screen or surface.

The key thing you should remember is, *screen, *location and *text all are same type (SDL_Surface type pointer). But we will actually put all *location and all *text in that single *screen. It’s like, putting plate with different types and colors in a single big plate.

 

So, that’s pretty much of variables of this class. I will discuss about the functions in next part. Till then, have a nice time… Good bye.