Archive for the ‘How-to’ Category

How to redirect all http request into https using htaccess?

To redirect http url or request into https version you need to add certain rules into .htaccess file. To do this you need to create .htaccess file or edit if you already have it. Add the following rule in .htaccess file: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://yourdomain.com/$1 The third line does the main work. It redirects all request into https version. Just change yourdomain.com into your ... Full story

How to solve www version of website not working?

Sometimes due to misconfiguration www version of the website does not works. i.e https://domain.com works and https://www.domain.com does not works. To solve this issue you need to add DNS record. Add the following and save: Type:CNAME Name:www Value:@ TTL:3 Hour To do this on godaddy server follow the steps: Login to your account. Go to My Products > Domains. Go to DNS of respective domain. Click on ADD button. Add the value for Type, Name, ... Full story

How to solve java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer

To solve the this problem just put the following code below tag on the manifiest tag. For eg: <application android:icon="@drawable/icon" ...... android:theme="@style/AppTheme.NoActionBar"> <uses-library android:name="org.apache.http.legacy" android:required="false"/> This problem is caused by targeting target Android 9 and above versions ... Full story

How to solve “NotAllowedError: play() can only be initiated by a user gesture.” audio problem in javascript android webview?

While playing audio in javascript using webview in android platform we may encounter following problem NotAllowedError: play() can only be initiated by a user gesture.. This is due to security and good user experience issue. So to enable sound play we should use following code in android: Android SDK below 17 will not support this hack so we should use the condition. Please comment if ... Full story

Android Device not detecting on computer device or android studio? Solved

I had come across weird problem i.e my android device is not being detected on any of the computer device either Mac or windows. I went through several websites but none of them worked. Being depressed one day an idea busted. I thought to clean the port. Yes i cleaned every dirt on the phones charging port and it worked like a charm. Now the android phone ... Full story

How to convert Mysql Database to SQLite database?

I have found a simple way to convert the Mysql Database into SQLite database. Following are the steps: Open PhpMyadmin on your browser. (eg. http://localhost:8888/phpmyadmin) Select database and click on Export. Make sure SQL is selected as format and click go. Make a copy of the mysqlcode and store in a file db.txt. Download DB Browser for SQLite from sqlitebrowser.org . Create new Database and create table. Navigate to Execute SQL ... Full story

How to make Facebook comment box responsive?

Responsive sites are very important now a days. Because it ranks well in the search engines. Sometimes third party widgets like facebook like box and comment box can perform worst. In such case you need to write your own css to make facebook comment box responsive. Here is the css code to make facebook comment box responsive: CSS to make Facebook comment box responsive Please do ... Full story

How to perform case insensitive array search in php?

Searching is a usual and regular task in programming. Letters case sensitivity is a problematic in searching. Hence, both search string and array string should be converted into same case before searching. Otherwise searching would return the empty result. Here is how to do it: As shown above, search string is converted into lowercase and all the items of an array are converted to ... Full story

How to optimize if else statement in a smart way?

In this tutorial i am going to show how can we optimize the if else statement. This method can be used in any programming languages. I am going to show two different ways we can optimize the if else statement. lets see default if else statement: if( n % 2 == 0){ result = n + " is even number"; }else{ result ... Full story

How to transfer existing domain with another hosting in cpanel for godaddy hosting?

Suppose you have old Hosting H1 and domain D1. You have purchased new hosting H2 with cpanel. Now you want domain D1 to new hosting as a multiple hosted domain in H2. To do this follow following steps: Copy all files and databases related to domain D1 from Hosting H1 o new Hosting H2. Go to Domain Manager and select domain D1. Now click on DNS Zone File ... Full story
Copyright © 2024 Programmer to Programmer- A website for web programming and mobile application programming tutorials.
Wordpress themes