My visit to PSTU

Yesterday (7th november 2015) i made a sudden visit in Patuakhali Science and Technology University for a day. This blog post describes information about my visit.

Our campus failed to attend this year ACM ICPC due to low rank and unable to solve more then 1 problems. Which is little embarrassing for us as we attended ICPC before, i was there to know what is the exact reason behind this.

the campus is not as beautiful as it was, due to raising buildings with very little space. The space in front of LH is no more (so much memories, right?) but CSE now have their own 2 floor and 2 more floors are allocated and under construction for them. On the other hand, the extension section after the bazar is not as open as it was then. The MK Hall got extension and another hall name Bangobondhu Hall constructed for male students. Don’t worry female seniors, LH is also extended.

I explored the campus at 7 am immediately i reached campus as i was sure that i will not get enough time later, how correct was i? I didn’t get much time to even talk to 2nd semester properly!

The first encounter i faced with 8th semester. I think i spend most of the time with them, and there was reasons for that! They showed me their projects in PHP, Android and .NET and i am really happy to see their projects. They worked good, we did not done it when we are in 8th semester and they are updating their projects. I have seen they developed a E-Commarce from scratch, although it is not difficult and almost useless as there are tons of E-Commarce framework available in market but still, doing something from scratch is educative and fun. They did it nicely.

There android project are piece of art! The sms hiding system is good. I told them to hide pictures so that we can send picture securely. They also showed me some work that uses GPS, like find someone via GPS and finding and extracting information about Bus. There work are good.

Can you imaging 4th semester are working on Unreal Engine? That was fun to work on them. But i think i didnt finish there last question on how to lean camera, my bad!

Also they are working on ACM ICPC and algorithms. That’s good for them (and for us also!)

I didn’t get enough time for this batch to understand them properly. But they are interested in Software development in general and programming contest. And they are afraid of programming. Its our bad!

I missed one batch entirely, I think it is 6th semester. I learned that they were unaware of my coming to campus. Well that blame goes to me of course as my visit was not planned before head.

The problem i saw that the relation between teachers and students are degrading. The students, as we did it when we were students, don’t go to teacher to solve problems and discussion. In these way a tension is raising between teacher and student. I suspect there are 2 reasons behind this, first one is students are afriad of what teacher will say to them and teachers are not technically reading students mind. Every student has different needs, teacher need to understand what are the need of students, also student should express (politely) their needs and queries to teachers. A good teacher student relationship is needed for CSE Faculty as i am afraid that our admin is not (and i am more afraid it will never be) in favor of CSE.

Now the main issue, The failure of ICPC. CSE currently don’t have a guide for that. Teachers have the knowledge but as i told earlier students are not going to them. And currently no seniors have experience of ICPC. That’s bad, really bad. There is a gap between time frame which causes this trouble. Even if we solve this, they will really need someone who can guide them for ICPC.

Same goes for software development, PSTU CSE has a lots of valuable assets but these assets are not spending times to student at a mass level. The seniors of PSTU CSE needs to come forward to deal with it. Both in software section and in algorithm section.

Note: i am not saying the networking or hardware section should be out of concern, just those are not my area of expertise.

As i am writing this, there will be a teacher student meeting at 3:30 pm today, hope a lot of things will be resolved by that.

What i want to say to PSTU CSE, be united, be creative, have fun and prosper. Focus on your study, also make a career path and get guideline from your senior and teachers, teachers will blame you or will criticize you for something, let them be, cause this will help you to understand your lacking and weaknesses, it will help you to be strong, and be strong. That’s your teacher are doing for you! Be gentle and co operative to them. And make that faculty one of the best faculties in Bangladesh.

searching an element inside array in php

You can use in_array function.

here is a quick example taken from [1]

 $people = array("Peter", "Joe", "Glenn", "Cleveland");
 if (in_array("Glenn", $people))
   echo "Match found";
   echo "Match not found";



Adding twig in slim framework

Ok, here how i worked to implement this,

First i added twig in require section of composer.json


then i update my vendor using composer update.

after that, in my index.php, i added the following lines

$loader = new Twig_Loader_Filesystem('application/views/');
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',

note that, i am storing my view files in application/views folder and will store cache in cache folder.

at this point, i created a test route

    global $twig;
    $data = array('inp'=>1);
    echo $twig->render('twig_test.twg.php', $data);


the view file (twig_test.twg.php) is pretty simple,  i just added this line in view file to test that my twig configuration is working well.


then finally, boot up the php development server using php-S and went to localhost/twig to confirm that twig is working with slim framework

php json_encode() show’s null instead of text


json_encode expects strings in the data to be encoded as UTF-8.

Convert them to UTF-8 if they aren’t already:

$results = array_map(function($r) {
  $r['text'] = utf8_encode($r['text']);
  return $r;
}, $results);
echo json_encode($results);

Here is a usefull list of PHP tools…

Here is a usefull list of PHP tools that will help your day by day php works.

How to fix “Headers already sent” error in PHP

The following worked for me


  // code 



Hello world, I am Laravel (5)

So there is this thing called Laravel. You may have heard of it already, but you’re not sure what it is actually about? Or you do, but want to know more about it and its great new features in version 5? Great, this post is especially for you! Laravel is at the same time one of the youngest and most popular PHP frameworks out there. So how does this work together? Let us take a closer look at why it is that popular and how it could be of use for you too. We will go through the main functionalities and talk about brand new features in version 5.

via Christoph Rumpel.

Every PHP Web Developer should know these things



Round in PHP

it is

float round ( float $val [, int $precision = 0 [, int $mode = PHP_ROUND_HALF_UP ]] )


echo round(3.4); // 3
echo round(3.5); // 4
echo round(3.6); // 4
echo round(3.6, 0); // 4
echo round(1.95583, 2); // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2); // 5.05
echo round(5.055, 2); // 5.06

PHP Array Multisort Object: Sort multidimensional array by different columns – PHP Classes

PHP Array Multisort Object: Sort multidimensional array by different columns – PHP Classes.