Ads Inside Post

Search in This Blog

How to activate gzip or deflate in Nginx Server

How to activate gzip or deflate in Nginx Server

If you have Nginx server and you deployed a site and seeing site is not producing data as gzip or deflate; it's means the gzip or deflate is not active in your nginx server. so how to activate it? 

The server configuration file name is nginx.conf and it's location is "etc\nginx\" folder.

You needed to put some configuration code, it is listed below:

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

After that configuration restart the server and check and still not working then add below lines too.

gzip_proxied any;
gzip_buffers 16 8k;
gzip_types    text/plain application/javascript application/x-javascript text/javascript text/xml text/css;

gzip_vary on;

*Note that It is not a typo, There is a space between 16 8k;

SQLSTATE 42S02 Base table or view not found 1146 Table doesn't exist

SQLSTATE[42S02]: Base table or view not found: 1146 Table doesn't exist

I have faced the very strange Mysql problem. I have the database name "DAVP" and having various tables. All the tables are existing with few of records.

Now I have queried to select some rows from one of table and surprise query showing error that the table "sark_rec" is not existing. It is wondering that the table "sark_rec" is existing!!. 

I spend lot of time in Google but did not found any solution related to this strange problem. 

So lastly I have solved it myself. I have just added database name just before table name with dot. see below solution sql query.

select *from DAVP.sark_rec;

Object must be of type String while sorting datagridview

Object must be of type String

You are working with DataGridView with  several columns. You want to make sort of one column name "marks". then you will simply use below one line of code:

dataGridView1.Sort(dataGridView1.Columns["marks"], ListSortDirection.Ascending); 

But you may get error message as below:

System.ArgumentException was unhandled
  Message="Object must be of type String."
       at System.String.CompareTo(Object value)
       at System.Collections.Comparer.Compare(Object a, Object b)
       at System.Threading.ThreadHelper.ThreadStart()


Let me try to understand you why the error message "Object must be of type String." You are getting when sorting "marks".

Very first time You are getting data from database and storing in the your datagridview something like this, note that string marks:

string marks = ds.Tables[0].Rows[grid_sr_no]["marks"].ToString();
dataGridView1.Rows[i].Cells["marks"].Value = mark;

after some processing in the seconds time you are string marks as intereger like this:

int marks = Convert.ToInt32(ds1.Tables[0].Rows[0]["marks"].ToString());
dataGridView1.Rows[i].Cells["marks"].Value = marks;

Then after if you use sorting code as below:
dataGridView1.Sort(dataGridView1.Columns["marks"], ListSortDirection.Ascending); 

You will get error message:
System.ArgumentException was unhandled
 Message="Object must be of type String."

so, to overcome this problem only use similar datatype while storing in datagridview.
alternatively you can use below code:
dataGridView1.Rows[i].Cells["marks"].Value = marks.ToString();

Software caused connection abort Failed to retrieve directory listing in FileZilla

Software caused connection abort Failed to retrieve directory listing in FileZilla

FileZilla is a Good software for FTP and SFTP to upload and download files in web-server. sometime in a folder having lot of files for ex: >50000 at that time when you want to see those files simply you double click on that folder. but you surprised that you will get below message:

"Network error: Software caused connection abortError: Failed to retrieve directory listing"

to solve above problem you need to set something in your FilZilla. follow below steps:
1- Open FileZilla 
2- Click on Edit menu => Setting 
3- Choose "Connection" and then in right side put 9999 in the box of "Timeout in seconds".

How to use $_POST in better way

How to use $_POST in better way.

Suppose there are 10 fields in a PHP webpage that's data are saving into database.
In that 10 fields 2 fields are empty and when in values are empty you want store "N/A" values are saving into database. 

Use below one line of code:
$myval = isset( $_POST['myvar'] ) ? $_POST['myvar'] : 'N/A'; 

You can use this logic in any website programming language.

How to check if internet active in your computer

How to check if internet active in your computer

When you write code in JavaScript sometime you code does not execute due to loss of internet connectivity.  so how you check if internet connection properly ON in your computer system.
below is one line of JavaScript code that check your system internet connect On of OFF.

Code is:
var isonline = navigator.onLine;

how to fix Configure the viewport

How to fix Configure the viewport

Sometime when you increase score of your site in Google PageSpeed Insights for SEO purpose and optimize it's responsiveness you can face the issue Configure the viewport. It is simple to fix the Configure the viewport issue. use only this below meta tag. if you have already this similar meta tag with extra aruments then just delete that one and use below code.

Tag is:
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Ebay is Fraud

Ebay is Fraud

Ebay is Fraud company.
ebay allow cheap and fraud sellers to sell his damage items from ebay site.
When you order items they deliver fake and damage item and when you claim in ebay then after claim ebay automatically close your claim... it is total bullshit!

Ebay is totally fraud company!!!

how to include js file in JavaScript code

How to include js file in JavaScript code

Sometime you need to include js file in javaScript code. below is the code that will solve this problem.

<script type="text/javascript">//<![CDATA[
document.write('<script src="url_path/js/js-file.js"><\/script>');

delete multiple emails in Gmail basic HTML mode

How to delete multiple emails in Gmail basic HTML mode

Sometime you have slow internet connect, so at that time you will not able to open gmail in standard mode. at that time you will open it in HTML mode.
It is okay. now when you want to delete multiple emails(100 emails at a time) then you need to click checkbox one by one. this will take many times and frustration.
here is the solution for this types of situation. see below image and follow instructions.

XSS Exploits

XSS Exploits

It is XSS, It is Web site hacking. It is cross site scripting (XSS). 
The most usual form of Web site hacking . hackers force a site to perform certain actions like inject a client side scripting code (JavaScript) mixed with submitted content.

so that when a user visits a Web page with the submitted content, the malicious script gets downloaded automatically in his web browser and gets executed.

Using this types of hacking user's cookies and session stolen and sent to site of the attacker.
the user may get redirected to a targeted Web site for instance.
XSS may also be used for user account hacking. When the attacker is able to steal the session cookie value, he may be able to access to the user account as if it was the real user.

Prevention of XSS Exploits

XSS vulnerabilities can be avoided by properly encoding HTML using entities for <, >, " and '. Escaping of HTML characters on online forums can also be avoided by using bbcodes usually offered there.

The htmlpecialchars() function can be helpful in this regard as it converts content automatically into HTML entities. It also converts single quotes by using ENT_QUOTES as second argument. The strip_tags() function also removes PHP and HTML tags from string.

update control value in C# Thread

How to update control value in C# Thread.

Use below sample of code:

Thread t1=new Thread();
String b="";
int all=0;
 private void button5_Click(object sender, EventArgs e)
            t1 = new Thread(new ThreadStart(MyCodeRun));  t1.Start();

void MyCodeRun()
           while (String.IsNullOrEmpty(b) || String.IsNullOrWhiteSpace(b))
                this.BeginInvoke(new MethodInvoker(changeValue));
                all = all + 1;

 private void changeValue()
            label1.Text =all + "";

JSON parse in PHP

JSON parse in PHP

Suppose you want to parse listed below JSON data in PHP and you only needed to print objectId values. you can see here 3 records under merchants value "RPEZF3MRM39Z0"

"appId": "0QA16KMMVJAQR",
"merchants": {
"RPEZF3MRM39Z0": [{
"objectId": "O:S1MXC6FCY6GDW",
"type": "UPDATE",
"ts": 1453110818494
}, {
"objectId": "O:S1MXC6FCY6GDW",
"type": "UPDATE",
"ts": 1453110818913
}, {
"objectId": "P:SYD46NHH64EQG",
"type": "CREATE",
"ts": 1453110818913

php code:

suppose $st is hlding the above json data.

foreach ( $json_a['merchants']['RPEZF3MRM39Z0'] as $objectId )
    echo $objectId['objectId']."</br>";

Video Cutter

Video Cutter

A Windows based Video cutter application. compatible with Windows 7, Windows 8,Windows 10 for 32 and 64 bit.

You do not stop or pause movie while cutting any part from video. just watch video while my application cut the part which you set.

Video Cutter

Video Cutter

Cut part/parts of large video files. This can be useful for cutting favorite or removing unwanted sections of video, such as commercials, outtakes and trailers.

The application is easy to use and has a simple, standard interface. What is really noticeable about this application is the speed.

Overall, Free Video Cutter is a relatively lightweight application that has good options to choose from and to select portion. It is rapid at standard conversions and the user interface is uncluttered and standard. If you want a basic video cutter application, then Free Video Cutter is a good choice.

Key features include:
Support for numerous formats including AVI, MP4, FLV, WMV, MOV, VOB, and 3GP.
Loss-less video cutting quality.
Rapid file processing.
Standard user interface.

Download links:

Download all the files and remove ".txt" extension. extract it.
Password is VideoCutter