Send a message LEAVE to 9243000111.
And you will get unsubscribed without any hassle.
The Socially Inactive.. But willing to share
Wednesday, 7 September 2016
How to unsubscribe from FoodPanda sms
Monday, 11 January 2016
Useful commands to use .htacess
Redirect /old_dir/ http://www.yourdomain.com/new_dir/index.html
this command redirect the user visiting to the old_dir to the site http://www.yourdomain.com/new_dir/index.html.
DirectoryIndex index.html
this command directs the server to serve the index.html file when the directory in which .htaccess file is residing, is accessed
AddType application/octet-stream .bin .exe
this command force the browser to save the files having the extension .bin & .exe
SSI stands for Server Side Includes. Inside an html file, we can include another html or cgi file using SSI. These things usually happens with shtml file. But to make it happen with .html files. We use the command shown below:
<!--#include virtual="/files/document.html"-->
This url is relative
IndexIgnore *.zip *.jpg *.gif
This command does not let the zip, jpg and gif files appear in the directory listing
Options +Indexes
allows the web apache serve to enable directory listing
Options -Indexes
disable the directory listing
Where /includes/ is your includes directory.
this command redirect the user visiting to the old_dir to the site http://www.yourdomain.com/new_dir/index.html.
DirectoryIndex index.html
this command directs the server to serve the index.html file when the directory in which .htaccess file is residing, is accessed
AddType application/octet-stream .bin .exe
this command force the browser to save the files having the extension .bin & .exe
SSI stands for Server Side Includes. Inside an html file, we can include another html or cgi file using SSI. These things usually happens with shtml file. But to make it happen with .html files. We use the command shown below:
<!--#include virtual="/files/document.html"-->
This url is relative
IndexIgnore *.zip *.jpg *.gif
This command does not let the zip, jpg and gif files appear in the directory listing
Options +Indexes
allows the web apache serve to enable directory listing
Options -Indexes
disable the directory listing
If you have a directory containing PHP includes, that you do not wish to be accessed directly from the browser, there is a way of disabling the directory using Mod_Rewrite.
To enable this, create a .htaccess file following the main instructions and guidance, and include the following text:
To enable this, create a .htaccess file following the main instructions and guidance, and include the following text:
|
Where /includes/ is your includes directory.
Sunday, 15 November 2015
How to add library to an android project in eclipse with steps
Make sure you are adding a library to an android project only.
- Download the library to your computer.
- Create a new folder, libs, in your Eclipse/Android project.
- Right-click libs and choose Import -> General -> File System, then Next, Browse in the filesystem to find the library's parent directory (i.e.: where you downloaded it to).
- Click OK, then click the directory name (not the checkbox) in the left pane, then check the relevant JAR in the right pane. This puts the library into your project (physically).
- Right-click on your project, choose Build Path -> Configure Build Path, then click the Libraries tab, then Add JARs..., navigate to your new JAR in the libs directory and add it. (This, incidentally, is the moment at which your new JAR is converted for use on Android.)
Monday, 9 November 2015
How to use Git with steps
- At first go to the folder in which using "cd .." and "cd [folder-name]". If you have used in similar way in command prompt, then you don't be guided about the first step.
- To first initialize, use "git init"
- Then, to check the untracked files, use "git status"
- Now, add the files into the tracked ones using "git add [file-name]", if you have not any files in the folder, then you will have to create one and then add.
- Use "git commit -m [Message]" to confirm with the message to identify what you are doing.
- Create a github account and create a repository there. Now that repository would have a link like https://github.com/[Username]/[Repository-Name].git
- Its to time to type the command "git remote add origin [Link-of-the-git]".
- Next, push it to cloud using command "git push origin master"
- A prompt will appear to type the username and password. Next your files will be the clouded in the desired repository.
Once I was using "git push origin master" to push my new update work. But an error was coming:
error: failed to push some refs to 'https://github.com/rajatraj733/firefox-extension.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
http://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to
Then, I used the above mentioned link to rectify the error. What I did was:-
- 1st command: git pull --rebase origin master
- 2nd command: git push origin master
By the way, I will explain these things like why such errors happened, later so that I could know the principle of github.
Friday, 6 November 2015
How to sort a pair or a structure based upon its element
For simple sorting in C++, sort() method is used of algorithm header.
e.g.
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> a;
int t;
for(int i=0; i<n; i++)
{
cin>>t;
a.push_back(t);
}
sort(a.begin(), a.end());
for(int i=0; i<n; i++)
cout<<a[i]<<" ";
}
Input:
5
4 8 9 2 1
Output:
1 2 4 8 9
But for advanced sorting, where structures would be sorted based upon its one of the element, we need to create a method compare to guide the sort method. Check it out below:
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
struct node {
int value;
int key;
};
bool compare(const node& a, const node& b) {
return a.key < b.key;
}
int main() {
int n;
cin >> n;
vector<node> a;
int t1, t2;
for (int i = 0; i < n; i++) {
cin >> t1 >> t2;
node t3;
t3.value = t1;
t3.key = t2;
a.push_back(t3);
}
sort(a.begin(), a.end(), compare);
for (int i = 0; i < n; i++)
{
cout << a[i].value << " "<<a[i].key<<endl;
}
}
Input:
5
4 7
7 4
2 5
9 6
3 8
Output:
7 4
2 5
9 6
4 7
3 8
So, you can check out that the nodes are sorted based upon its "key" variable.
In the similar way, you can sort the pairs based upon its "first" variable or "second" variable, whichever you do want.
e.g.
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> a;
int t;
for(int i=0; i<n; i++)
{
cin>>t;
a.push_back(t);
}
sort(a.begin(), a.end());
for(int i=0; i<n; i++)
cout<<a[i]<<" ";
}
Input:
5
4 8 9 2 1
Output:
1 2 4 8 9
But for advanced sorting, where structures would be sorted based upon its one of the element, we need to create a method compare to guide the sort method. Check it out below:
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
struct node {
int value;
int key;
};
bool compare(const node& a, const node& b) {
return a.key < b.key;
}
int main() {
int n;
cin >> n;
vector<node> a;
int t1, t2;
for (int i = 0; i < n; i++) {
cin >> t1 >> t2;
node t3;
t3.value = t1;
t3.key = t2;
a.push_back(t3);
}
sort(a.begin(), a.end(), compare);
for (int i = 0; i < n; i++)
{
cout << a[i].value << " "<<a[i].key<<endl;
}
}
Input:
5
4 7
7 4
2 5
9 6
3 8
Output:
7 4
2 5
9 6
4 7
3 8
So, you can check out that the nodes are sorted based upon its "key" variable.
In the similar way, you can sort the pairs based upon its "first" variable or "second" variable, whichever you do want.
Subscribe to:
Comments (Atom)