Tuesday, June 26, 2018

ஏழரை சனி

ஏழரை சனியில் மூன்று வகைகள் உள்ளது. விரைய சனி, ஜென்ம சனி, பாத சனி...அதாவது முதல் சுற்று இரண்டாம் சுற்று மூன்றாம் சுற்று என மூன்று சுற்றுகள் உள்ளது.

ஏழரை சனி
மூன்று இரண்டரை வருடங்களை கொண்டது தான் ஏழரை சனி. முதல் இரண்டரை ஆண்டுகளில் ஏழரை சனியின் தாக்கத்தை உணர்வது இல்லை. இந்த காலத்தில் பொருள் வரவும் இருக்கும். இந்த காலக்கட்டத்தில் சிலரிடம் நல்ல பண வரவு கூட இருக்கும்.

நடுப்பகுதி
ஏழரை சனியின் நடுபகுதியான, அதாவது முதல் இரண்டரை ஆண்டு முடிந்து மூன்றாம் ஆண்டு இடையில் இருந்து தொடங்கும் இந்த சமயத்தில் கடுமையான கெடு பலன்களை கொடுக்கும்.

இந்த சமயத்தில் தான், ஒருவரின் சொந்த நட்சத்திரத்தில் ஏழரை செல்வதால் மிகுந்த பாதிப்பை ஏற்படுத்தும்.

பாத சனி
கெடுபலன்கள் குறைய ஆரம்பிக்கும். ஆனாலும் இந்த நிலையில் முழுமையான நன்மைகள் நடந்து விடுவது இல்லை. சனி முழுவதுமாக முடிந்ததும் அந்த மனிதர் செட்டிலாகும் வாழ்க்கை வாழ்வதற்கான ஆரம்பங்கள் இந்த பாதச் சனி அமைப்பில் நடக்கும். இந்த சனி 40 வயதிற்குள் வந்தால் கடுமையான பாதிப்பை ஏற்படுத்தும்.

5 வயது வரை சனியை பற்றி கவலை வேண்டாம்..!
விபரம் தெரியாத குழந்தைப் பருவமான ஏறத்தாழ 15 வயது வரை வருகின்ற ஏழரைச் சனியை ஒருபோதும் கணக்கில் எடுத்துக் கொள்ளவே கூடாது.

மேலும் வயதை பொருத்து சனியின் ஆதிக்கம் இருக்கும். மிக எளிமையாக சொல்ல வேண்டும் என்றால் வயதிற்கு ஏற்றவாறு கெடுதல்கள், தோல்விகளை சந்திப்பது உள்ளிட்ட பல விஷயங்களை சந்திக்க நேரிடும்.

Wednesday, June 13, 2018

CGG Singapore PHP Web Software Developer Interview Questions 2018

1. A news papers selling company sold 1500 papers in month in the average of $5. They paid the salary of TWO employees $1,600 that is 80% of their total expenses, What will be the profit for the company?, if you take any assumtion note down as well.

5500


2. A rectangle size car park's one side is 9ft, and the length of other 3 sides were 37. find the square feet of the car park (MSQ)


3. Apple, Orange and Apples and Oranges 3 boxes, watch in youtube https://www.youtube.com/watch?v=lBLoqvYqoG0

Wednesday, July 19, 2017

vsftpd with google cloud compute engine for ftp users

There is so many articles to connect sFTP to Google cloud but nothing for FTP for google cloud.

Commands that I have used.

Edit the vsftpd configuration file and uncomment the bellow lines. Use vim or nano. The lines that are not present in the conf file, put them at the bottom.
# vim /etc/vsftpd.conf

listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
nopriv_user=vsftpd
chroot_local_user=YES
allow_writeable_chroot=yes
guest_username=vsftpd
virtual_use_local_privs=YES
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/$USER
hide_ids=YES

# Exclude this if you are doing this guide on your own private server
seccomp_sandbox=NO 
Next, we should modify our /etc/pam.d/vsftpd file to check the users/passwords file that we are about to create.
First, create a backup of the file and then edit the existing one:
# cp /etc/pam.d/vsftpd{,.bak}

# vim /etc/pam.d/vsftpd
Remove everything from the file and add these lines instead:
auth required pam_pwdfile.so pwdfile /etc/ftpd.passwd
account required pam_permit.so
Create the main user that will be used by the virtual users to authenticate:
# useradd --home /home/vsftpd --gid nogroup -m --shell /bin/false vsftpd
Once that is done we can create our users/passwords file.
Note: The passwords used by this method can be up to 8 characters long. If you wish vsftpd to read stronger passwords you might want to search for a different pam module.
# htpasswd -cd /etc/ftpd.passwd rosetest1
Add another user and append it to the ftpd.passwd file. The -c flag is omitted here.
# htpasswd -d /etc/ftpd.passwd rosetest2
Next, add the directories for the users since vsftpd will not create them automatically.
## For rosetest1
# mkdir /var/www/rosetest1
# chown vsftpd:nogroup /var/www/rosetest1
# chmod +w /var/www/rosetest1

## For rosetest2
# mkdir /var/www/rosetest2
# chown vsftpd:nogroup /var/www/rosetest2
# chmod +w /var/www/rosetest2
Finally, start the vsftp daemon and set it to automatically start on system boot.
# systemctl start vsftpd && systemctl enable vsftpd
Check the status to make sure the service is started:
# systemctl status vsftpd
● vsftpd.service - vsftpd FTP server
Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled)
Active: active (running) since Sat 2016-12-03 11:07:30 CST; 23min ago
Main PID: 5316 (vsftpd)
CGroup: /system.slice/vsftpd.service
├─5316 /usr/sbin/vsftpd /etc/vsftpd.conf
├─5455 /usr/sbin/vsftpd /etc/vsftpd.conf
└─5457 /usr/sbin/vsftpd /etc/vsftpd.conf


vsftpd.conf file contents.

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
#write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO


listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
nopriv_user=vsftpd
chroot_local_user=YES
allow_writeable_chroot=yes
guest_username=vsftpd
virtual_use_local_privs=YES
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/$USER
hide_ids=YES
listen_address=0.0.0.0

pasv_min_port=12000

pasv_max_port=12100

pasv_address=35.185.147.119

listen_port=211

-----------------------------------------------------------------------------------------end-of-file--------------------------------------------

Modified contents maked as bold.


Add firewall rules to access via cloud.



Wednesday, September 9, 2015

Goolge Plus Merge Pages with Places Page

Follow the instructions bellow to merge your places page with a normal google plus page.

Situation in brief: I created a very new places page for my company in google plus and our company already having a google plus page.

In your Company / Places Page Account:
  1. Go to Dashboard
  2. Right Top side, there is a Gear Icon click on there and go to settings.
  3. Under the Profile section find "Connect Different Page" button.


Add next and finish your final steps.

Monday, January 26, 2015

PHP Clean URL for SEO

function seo_uri($phrase, $maxLength=50){
  $result = strtolower($phrase);
  $result = preg_replace("/[^a-z0-9\s-]/", "", $result);
  $result = trim(preg_replace("/[\s-]+/", " ", $result));
  $result = trim(substr($result, 0, $maxLength));
  $result = preg_replace("/\s/", "-", $result);
  return $result;
}

Wednesday, April 30, 2014

Installing PHPUnit On Windows

I wanted to start contributing to the WordPress unit tests so I needed to install PHPUnit. Turned out it was harder than it might seem (I had a tough time getting it all working) so I thought I’d blog what finally ended up working for me to help save some people some time.
Assuming you already have PHP and MySQL installed, here’s the steps you need to take:
  1. Install PEAR, a dependency for PHPUnit:
    1. Visit http://pear.php.net/go-pear.phar in your browser and save the file into your PHP directory. This is the folder where you can find php.exe.
    2. Open an administrator command prompt. On Vista or Windows 7, hit your Windows key, type “cmd”, right-click the resulting “cmd.exe” search result, and select “Run as administrator”. Navigate to the folder where you have PHP installed, the same folder where you saved the file in the previous step.
    3. Type the following command to execute the file you just downloaded: php go-pear.phar
    4. After a moment, you should start being prompted for some things. The installer is pretty self-explanatory and I think you want a system installation rather than a local one.
    5. Open the folder where PHP is installed and double-click the PEAR_ENV.reg file that has been created. This allows you to run the pear command from any folder.
    6. Verify PEAR is working by running the command pear version
  2. Install PHPUnit:
    1. Turn on auto_discover in PEAR by typing the following command at the command line: pear config-set auto_discover 1
    2. Download and install PHPUnit by running the following command: pear install pear.phpunit.de/PHPUnit
    3. In order to be able to run the phpunit command from any folder, you need to add it to your Windows Path value. Right-click My Computer → Properties → Advanced system settings → Environmental Variables → select “Path” under “System Variables” → Edit → Add a semi-colon (;) and then the full path to your PHP folder onto the end of the value, for example like this: ;D:\Webserver\php
    4. Verify PHPUnit is working by running the command phpunit --version
  3. Set up the WordPress unit tests by following the rest of the steps on the WordPress Core Contributor Handbook now that you have PHPUnit installed.
Done!

Monday, January 13, 2014

Simple PHP PDO Class Implementation

Simple PHP PDO Class Implementation

$host = "127.0.0.1";
$db = "sample";
$username = "root";
$password = "";

$database = new PDO("mysql:host=" . $host . ";dbname=" . $db, $username, $password);

function find_user($username) {
 global $database;
 $p = $database->prepare("SELECT * FROM member WHERE username = ?");
 $p->execute(array($username));
 return $p->fetchObject();
}

$results = find_user("admin");
var_dump($results);

Out put of this function will be like bellow.
object(stdClass)[3]
  public 'id' => string '4' (length=1)
  public 'username' => string 'admin' (length=5)
  public 'password' => string '240824aa0487bca3bdd4deb847954b76' (length=32)
  public 'email' => string 'bthssssiban@gmail.com' (length=17)
  public 'postcode' => string 'Q2Z23S' (length=6)
  public 'status' => string 'Inactive' (length=8)
  public 'code' => string '4172f3101212a2009c74b547b6ddf935' (length=32)
  public '_date' => string '2011-02-17' (length=10)


echo $results->username; will prints the output of the username of value from the database.