How to force download a file using ASP.NET
There are many cases where we need to let file downloads being processed by an aspx file. Here in this code this code will force a file to be downloaded through an aspx file. let assume your file path is in “string path” variable. Add this code in your aspx file cs file.
string path = "the path to your file";
string fileName = "Add your file name";
string contentType= "Add your file content type. ex: for text file it is 'text/plain'";
string contentLength = "add string presentation of your file size in bytes";
response.Clear();
response.ClearHeaders();
response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
response.AddHeader("Content-Length", contentLength);
response.ContentType = contentType;
FileStream f = new FileStream(path, FileMode.Open);
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = f.Read(buffer, 0, buffer.Length)) > 0)
{
response.OutputStream.Write(buffer, 0, len);
}
response.OutputStream.Flush();
response.OutputStream.Close();
response.Flush();
response.Close();
response.End();

Pipilika – The Search Engine of Bangladesh
We are introducing first ever multilingual Web Search Engine Pipilika in Bangladesh both in Bengali and English. This free web service provides search results on nationwide news and business information to the people and for the people. The focused crawler crawls news data from the popular daily newspapers and it indexes them in our indexer. Hence the search engine is able to supply up-to-date news, articles, reviews etc. of different news portals. Renowned Search Engines have not paid much attention on Bengali search. So, we tried to give more emphasize on Bengali news analysis and searching.
Group by date from a datetime or timestamp field in Mysql
This is a simple but greatly useful mysql query. You can use it to find all the dates even with time included in datetime or timestamp field.
Create custom notification on your Ubuntu desktop using python
You can easily create custom notifications for your applications on ubuntu. Ubuntu’s current notification system is called NotifyOSD. It provides api for several languages. Using python-notify library it is really so easy than in any other.
Ubuntu by default have the python-notify installed. If don’t install it using
sudo apt-get install python-notify
Convert unicode codepoints to unicode hex values in java
In a part of our crawler development, we encountered a Bangla news site (http://www.kalerkantho.com/) which uses code points instead of unicode hex valus in their website. Although it renders banla fonts in browser, but when viewings source it only shows code points, so when downloaded by crawler we only got কકى similar. For the indexing purpose we needed to convert them to hex values so that it renders bangla font anywhere. The process of converting is really so simple.
Extract hyperlinks from html using regular expression in java
2 years ago, I worked with an crawler which can fetch webpages from internet, then parse the links from the page and then visit all the pages linked to the page. At that time I didn't have any idea about regular expressions. So I had to write around a 500 hundred line code to parse links and meta tags from html.
Yesterday, I had to do the same job again. This time I took up regular expression to parse the html <a tags followed by href attribute to extract the links.
Regular expressions can be difficult to understand if written at once, so I am going to write it in easy way first, then i ll make it complex to support variations in page links.
How to allow users to execute sudo command in ubuntu
If you have a user account that cannot make sudo command then it because it is not in sudoers list. You must add the user to sudoers list to allow sudo command. Sudoers list is located in /etc/sudoers
So open up the file with visudo command. You must use this command to edit this
How to add users and usergroup in ubuntu using terminal
It is very easy to create new user account in ubuntu using terminal. Just follow adduser and addgroup command.
Here is an example
I want to create a user named "nutch" with a new "nutch" user group. Here is how I did it.
Change root user password in ubuntu using terminal (The short way)
If you forget the root user password you can change with a simple tricky command in ubuntu. Login to your regular account. You should have the sudo comman available for your user account.
Now open the terminal and enter the command
sudo passwd
This will let you to change root account password as you used sudo! Now enter the new password and confirm. Yes! You are done ![]()
Run cron from external server when you dont have cron support!
Cron jobs are used to execute scheduled tasks on UNIX web servers. It is similar to windows scheduled task. Using it you can performs lots of required tasks for your website or application like monthly bill payments check, updated check, clearing cache or temporary files and lots more.
In linux it is set using crontab command. If you have cpanel then it will also provide you an user interface to manage your cron jobs. Most paid hosting support these. But in most cases it is not available on free hosts. But still if you need this, to maintain a regular check or execution of something and you dont have this feature provided by your host, you can still manage to do so…


