how to run create file in ubuntu when user login automatically

  • Create a script file, e.g. named my_file.sh, in the /etc/profile.d/ directory.
  • Put #!/bin/bash as the first line.
  • Write whatever command(s) you want to be executed immediately after logging in, e.g. pgrep udhcpd.
  • Mark your file as executable: chmod +x /etc/profile.d/my_file.sh

*It should get executed after login. In case it doesn’t or you don’t have the ability to use root privileges, creating the same file under ~/.config/autostart should work fine (I haven’t tried this directory before).

how to run create file in ubuntu when user login automatically

You can add those lines at the end of your ~/.bashrc file which will get executed when you login.

I’m talking about the ~/.bashrc serverside. When you have added your lines and logout and ssh back in these lines will get executed. You can leave out the last line of your script.

If the ~/.bashrc does not exist you can simply create it or even better copy it:

cp /etc/skel/.bashrc ~/.bashrc

and make sure your ~/.profile file contains the following lines:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

run command in startup ubuntu

  1. Running crontab -e will allow you to edit your cron.
  2. Adding a line like this to it:@reboot /path/to/script will execute that script once your computer boots up.
@reboot /path/to/script

updating controller not reflected in twig file in opencart

Hi there, if you are using any kind of modification which affects the header file you need to refresh modifications first.

Log in to the backend (administration) and go to Extension > Modification and hit the refresh button in the right top corner.

google search with operators

Refine web searches

You can use symbols or words in your search to make your search results more precise.

  • Google Search usually ignores punctuation that isn’t part of a search operator.
  • Don’t put spaces between the symbol or word and your search term. A search for site:nytimes.com will work, but site: nytimes.com won’t.

Refine image searches

Overall Advanced Search

  1. Go to Advanced Image Search.
  2. Use filters like region or file type to narrow your results.
  3. At the bottom, click Advanced Search.

Search for an exact image size

Right after the word you’re looking for, add the text imagesize:widthxheight. Make sure to add the dimensions in pixels.

Example: imagesize:500x400

Common search techniques

Search social media

Put @ in front of a word to search social media. For example: @twitter.

Search for a price

Put in front of a number. For example: camera $400.

Search hashtags

Put in front of a word. For example: #throwbackthursday

Exclude words from your search

Put - in front of a word you want to leave out. For example, jaguar speed -car

Search for an exact match

Put a word or phrase inside quotes. For example, "tallest building".

Search within a range of numbers

Put .. between two numbers. For example, camera $50..$100.

Combine searches

Put “OR” between each search query. For example, marathon OR race.

Search for a specific site

Put “site:” in front of a site or domain. For example, site:youtube.com or site:.gov.

Search for related sites

Put “related:” in front of a web address you already know. For example, related:time.com.

See Google’s cached version of a site

Put “cache:” in front of the site address.

Important: Not all search operators return exhaustive results. 

smileys convert into question mark in CI

After wasting a lot of time with character variables and mysql configurations, I fixed the problem with a simple solution that is base64_encode.
Passing the input string through base64_encode and later using base64_decode to show them worked in this case. However the strings take up more space than earlier but this solution is really simple and worthy.
I just posted this question to know if someone ever faced something similar but people really do not get the main point of the question. That is where the people on SO get really exhausting. Anyways thanks for your help people! 🙂


		$content = base64_encode(nl2br($this->common->nohtml($this->input->post("content"))));
		
<?php echo base64_decode ($r->content) ?>
<?php if($r->site_flag) : ?>
	<?php $sites = $this->feed_model->get_feed_urls($r->ID); ?>
	<?php foreach($sites->result() as $site) : ?>
		<div class="feed-url-spot clearfix">
		<div class="pull-left feed-url-spot-image">
			<?php if($site->image) : ?>
			<img src="<?php echo $site->image ?>" width="100%">
			<?php endif; ?>
		</div>
		<p><a href="<?php echo $site->url ?>"><?php echo $site->title ?></a></p>
		<p><?php echo $site->description ?></p>
	</div>
	<?php endforeach; ?>
<?php endif; ?>
	

the main differences between INNODB and MYISAM

The most commonly used storage engine in MySQL are MyISAM and InnoDB.

With these storage engine there are some advantages and disadvantages according to application needs.

As you all know, the default storage engine chosen by MySQL database is MyISAM.

The main difference between MyISAM and INNODB are :

  • MyISAM does not support transactions by tables while InnoDB supports.
  • There are no possibility of row-level locking, relational integrity in MyISAM but with InnoDB this is possible. MyISAM has table-level locking.
  • InnoDB does not support FULLTEXT index while MyISAM supports.
  • Performance speed of MyISAM table is much higher as compared with tables in InnoDB.
  • InnoDB is better option while you are dealing with larger database because it supports transactions, volume while MyISAM is suitable for small project.
  • As InnoDB supports row-level locking which means inserting and updating is much faster as compared with MyISAM.
  • InnoDB supports ACID (Atomicity, Consistency, Isolation and Durability) property while MyISAM does not support.
  • In InnoDB table,AUTO_INCREMENT field is a part of index.
  • Once table in InnoDB is deleted then it can not re-establish.
  • InnoDB does not save data as table level so while implementation of select count(*) from table will again scan the whole table to calculate the number of rows while MyISAM save data as table level so you can easily read out the saved row number.
  • MyISAM does not support FOREIGN-KEY referential-integrity constraints while InnoDB supports.

MySQL – How to turn off ONLY_FULL_GROUP_BY?

If you run into this error with MySQL:

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'db.table.col' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

It’s likely because you have the ONLY_FULL_GROUP_BY function enabled. To fix this, you have to disable it.

Run this command:

mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

Another way to turn it off is that to find and modify the config file my.cnf. Usually it’s in /etc/my.cnf or /etc/mysql/my.cnf.

First, check the sql_mode by running this query:

SELECT @@sql_mode;

The result should be something similar to this:

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

Copy the sql_mode values, remove ONLY_FULL_GROUP_BY, edit my.cnf and put the rest together in a line under [mysqld] section:

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

Then restart the mysql server.

sudo service mysql restart to restart MySQL

How Do I integrate Opencart with Shiprocket?

Integrating Opencart with ShipRocket

Following are the ways to integrate Opencart with ShipRocket. Before you proceed with these steps, make sure that you have installed the Shiprocket plugin on your Opencart account.

Supported Version :

2.3.*,
2.2.0.0,
2.1.0.1, 2.1.0.2,
2.0.0.0, 2.0.1.0, 2.0.1.1, 2.0.2.0, 2.0.3.1

(Link to Download Extension)

Step I – Configuration at Opencart Extension

  1. Login to your Opencart admin panel.

2. Go to Extensions Tab -> Extension Installer. Upload the extension file downloaded from the link given above.

3. Once the file is successfully uploaded. Go to Extensions Tab -> Modules.

4. Add OpenCart Rest API.

5. Once the API’s are installed, click on the Add New button, enter the title as ShipRocket and click Save

6. Now you will get Public Key & Private Key for Opencart. Copy and save them.

Step II – Configuration at ShipRocket panel

1. Login to ShipRocket panel.

2. Go to Settings->Channels.

3. Click on “Add New Channel” Button.

4. Click on Opencart -> Integrate.

5. Switch “On” the Order and Inventory Sync as per your requirement.

6. Fill in the Parameters i.e Store Url,  public Hash, Private hash (as saved from the OpenCart panel) and Opencart version 

7. Click “Save Channel & Test Connection”.

8. The green icon indicates that the channel has been successfully configured.

php soap client install ubuntu

In case that you have Ubuntu in your machine, the following steps will help you:

  1. Check first in your php testing file if you have soap (client / server)or not by using phpinfo(); and check results in the browser. In case that you have it, it will seems like the following image ( If not go to step 2 ):
  1. Open your terminal and paste: sudo apt-get install php-soap.
  2. Restart your apache2 server in terminal : sudo service apache2 restart.
  3. To check use your php test file again to be seems like mine in step 1.

In Ubuntu/Debian 

$ php -i | grep -i soap   or $ $ apt-cache search php | grep -i soap
$ sudo apt-get install php-soap
$ sudo  service apache2 restart

or in RHEL/Fedora 

$ yum search php | grep -i soap
$ sudo yum install php-soap