Friday, May 18, 2018

Usage of break and continue statement in a shell script,Linux Teacher Sourav,Kolkata 09748184075

#!/bin/sh
#
# 18/5/2018
#
echo "Break Continue Example"
FN1=/tmp/break.txt
FN2=/tmp/continue.txt
x=1
while [ $x -le 1000000 ]
do
echo "x:$x"
if [ -f $FN1 ] ; then
echo "Running the break command"
rm -f $FN1
break
fi
if [ -f $FN2 ] ; then
echo "Running the continue command"
rm -f $FN2
continue
fi
let x++
sleep 1
done
echo "x:$x"
echo "End"
exit 0

You can test the script after creating the necessary files such as continue.txt and break.txt in the /tmp folder


touch /tmp/continue.txt

and the script will continue till x gets 1000000

to stop this use the tab feature in terminal and in a different tab use
touch /tmp/break.txt

The shell script will stop using the break statement

Using Let command in shell script error command not found solved,Linux Teacher Sourav,Kolkata 09748184075

If anyone is trying to learn shell script in ubuntu (in my case ubuntu 16.04), he or she might found out that bash built in commands such as let giving you command not found error ,to solve this you need to understand even if you put the line #!/bin/sh at the top of your script /bin/sh on ubuntu is dash not bash

So to solve this you need to reconfigure dash to not be the default shell

The command to accomplish this is

sudo dpkg-reconfigure dash


press no when asked for whether you like dash to be the default

and then everything should work fine


Source:https://ubuntuforums.org/showthread.php?t=1377218

Thursday, May 10, 2018

Send a message in your phone using VBA and TextLocal API.VBA Teacher Sourav,Kolkata 09748184075

Private Sub Command1_Click()
  
        Dim username As String
        Dim password As String
        Dim result As String
        Dim myURL As String
        Dim Sender As String
        Dim numbers As String
        Dim Message As String
        Dim postData As String
        Dim winHttpReq As Object
        apikey = Text1.Text
        Sender = Text2.Text
        numbers = Text3.Text
        Message = Text4.Text
    
        Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    
        myURL = "https://api.textlocal.in/send/?"
        postData = "apikey=" + apikey + "&message=" + Message + "&numbers=" + numbers + "&sender=" + Sender
    
        winHttpReq.Open "POST", myURL, False
        winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        winHttpReq.Send (postData)
    
        sendsms = winHttpReq.responseText
        MsgBox (sendsms)
       
    End Sub
   

**For promotional account which is mine the sender should be blank

**Due to TRI NCCP regulation after 9 pm and before 9 am you can not send message (error 192)
   


I followed this tutorial

https://www.youtube.com/watch?v=fc5ZNMXb4Fo

Tuesday, May 8, 2018

WI-FI getting disconnected/Networks not showing up on Ubuntu 16.04 solved ,Linux Teacher Sourav,Kolkata 09748184075


Install rfkill

sudo apt-get install rfkill
then run this command

rfkill unblock all
check if the wifi is working. If not do this

sudo nano /var/lib/NetworkManager/NetworkManager.state
then you will see some settings. Set everything to "true" reboot your system

give this command in terminal

rfkill list
you'll see that some are softblocked and hardblocked. All of them should be "no".

If it's not "no" then you need to somehow turn them to "no". I did this and it worked for me

sudo modprobe -r acer-wmi
cd /etc/modprobe.d
sudo nano blacklist.conf
Then add blacklist acer-wmi as a new line at the end of the file.

then save the file by pressing Ctrl+O ,close it and reboot the system. It should work

Source:https://askubuntu.com/questions/769521/wifi-networks-are-not-showing-in-ubuntu-16-04?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Friday, May 4, 2018

Install PHPMyAdmin after installing Mysql on Ubuntu 16.04

 sudo apt-get update
    sudo apt-get install phpmyadmin php-mbstring php-gettext

After opening PHPMyAdmin if you create a database and open it you may see

CONNECTION FOR CONTROLUSER AS DEFINED IN YOUR CONFIGURATION FAILED

You have to open this file

/etc/phpmyadmin/config-db.php

and see if the configuration is like this

$dbuser='root';
$dbpass='password'; // set current password between quotes ' '
$basepath='';
$dbname='phpmyadmin';
$dbserver='';
$dbport='';
$dbtype='mysql';

save and close the file

restart mysql server by

sudo service mysql stop

sudo service mysql start