May be its not true for all places in Bangladesh, but definitely applicable to my area, kathalbagan,dhaka.
This blog post is for bangladeshies only, specially people using internet through mobile network, those resides around kathakbagan,boshundhora city.
I was using grameen edge for almost a year. while i was in firmgate, was getting enough speed to work with. but, as soon as i moved to kathalbagan, i started getting very very low speed from gp edge internet. So, i got upset & tried to find some ways to get rid of this situation. At last, i found the solution, invented that here aktel network is much better than grameen. Now, I am using aktel edge internet & getting much better speed.
Here are some very small tips that will help you a little upgrading on your coding standards with html/css, may be you already know most of them :).
* You can use "@import" instead of "<link ". The diference is, css that are imported using @import won't be save to client machine using browsers "save as" option. They must have to save them individually. So, a man without basic html/css knowledge won't be able to get them.
* If you have many css files for various functionality, then instead of import them all to the main template/page, you can import only one css that imports all others. Like you only import allcss.css file and this file contains code like follows:
@import layout.css
@import style.css
@import plugin.css
@import other.css
This has one disadvantage also. This makes the the browser cache the files, so if you are in development mode, this will happen worse for you as you will not be able to see new changes just after reloading the page. so, its better to develop using <link tag and change to @import while production made as that will give visitor better performance because of caching strategy.
* You can use if else condition on CSS Style sheet for using liquid design for your site that will keep standard ratio on various monitors & screen resolution like follows:
body
{
width:expression(document.body.clientWidth > 1200? "1200px": "auto" );
}
expression attribute can use javascript condition code to get you an result.
* You can use "@import" instead of "<link ". The diference is, css that are imported using @import won't be save to client machine using browsers "save as" option. They must have to save them individually. So, a man without basic html/css knowledge won't be able to get them.
* If you have many css files for various functionality, then instead of import them all to the main template/page, you can import only one css that imports all others. Like you only import allcss.css file and this file contains code like follows:
@import layout.css
@import style.css
@import plugin.css
@import other.css
This has one disadvantage also. This makes the the browser cache the files, so if you are in development mode, this will happen worse for you as you will not be able to see new changes just after reloading the page. so, its better to develop using <link tag and change to @import while production made as that will give visitor better performance because of caching strategy.
* You can use if else condition on CSS Style sheet for using liquid design for your site that will keep standard ratio on various monitors & screen resolution like follows:
body
{
width:expression(document.body.clientWidth > 1200? "1200px": "auto" );
}
expression attribute can use javascript condition code to get you an result.
I was having some trouble doing insert/update image or other binary data to access database using asp.net/c#. At last successfully accomplished it and learned some important tips that I want to share with you all.
Uploading Image to Access Database using Asp.net/C#:
At first You must have to have a Database table field of type 'OLE Object'. now come to the c# coding part:
First get the info you need to store. You can store only the image instead of its type if you know the type of the image being uploaded. But its wise to store the type also. After file posted from the fileupload control, get its size,type & convert the posted item into byte stream.
int imgLength = uploaderSignature.PostedFile.ContentLength;
byte[] data = new byte[imgLength];
string type = uploaderSignature.PostedFile.ContentType;
uploaderSignature.PostedFile.InputStream.Read(data,0,imgLength);
then make a connection to the access database. If you are having proble with making the connectionstring, visit www.connectionstrings.com . Here I used OleDB connection:
System.Data.OleDb.OleDbConnection ob=new System.Data.OleDb.OleDbConnection();
ob.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=|DataDirectory|\ApecDB.mdb;";
Now create a command and add input parameter. Important thing to remember here, you can't insert the binary data using plain/string type sql query like
myCommand.ExecuteNonQuery("Update tblCompany SET "+column+"="+data+","+column+"_type="+type); this won't work at all. You must have to use parameter based command as like follows:
OleDbCommand myCommand = new OleDbCommand("Update tblCompany SET "+column+"=@img_stream,"+column+"_type=@img_type", ob);
// Mark the Command as a Text
myCommand.CommandType = CommandType.Text;
OleDbParameter img_stream = new OleDbParameter("@img_stream", OleDbType.Binary);
img_stream.Value = data;
myCommand.Parameters.Add(img_stream);
OleDbParameter img_Type = new OleDbParameter("@img_type", OleDbType.VarChar);
img_Type.Value = type;
myCommand.Parameters.Add(img_Type);
Then, its quite simple. open connection, execute query, close connection. If rows affected, then query successfull, return true, otherwise return false.
int affectedRows;
try
{
ob.Open();
affectedRows = myCommand.ExecuteNonQuery();
ob.Close();
}
catch (Exception exc)
{
return false;
}
if (affectedRows > 0)
{
return true;
}
else
{
return false;
}
Retrieving Image from Access Database using Asp.net/C#:
Retrieving image is quite easy compared to saving after using normal select query you have to define the content type & cast the data to byte & write it as Binary stream as follows:
Response.ContentType = dataRow["img_type"].ToString();
byte[] imageData = (byte[])dataRow[0]["img"];
Response.BinaryWrite(imageData);
You will find a working example on the following link that I found elsewhere:
http://rapidshare.com/files/289324545/InsertShowImageAccessDatabseAsp.netC_.rar.html
Also Remember:
* all image type isn't supported, so sometimes some are saved as "application/octetstream". they won't be retrieved in normal ways. You have to make a bitmap object from those kind og images & save them to database for retrieving them well. The follwing code snippet will show you how to make new image of another type:
Image originalImage = Image.FromStream(stream,true,true);
Bitmap targetImage = new Bitmap(originalImage, width, height);
with it, you can also resize an image to another size with custom width & height.
Uploading Image to Access Database using Asp.net/C#:
At first You must have to have a Database table field of type 'OLE Object'. now come to the c# coding part:
First get the info you need to store. You can store only the image instead of its type if you know the type of the image being uploaded. But its wise to store the type also. After file posted from the fileupload control, get its size,type & convert the posted item into byte stream.
int imgLength = uploaderSignature.PostedFile.ContentLength;
byte[] data = new byte[imgLength];
string type = uploaderSignature.PostedFile.ContentType;
uploaderSignature.PostedFile.InputStream.Read(data,0,imgLength);
then make a connection to the access database. If you are having proble with making the connectionstring, visit www.connectionstrings.com . Here I used OleDB connection:
System.Data.OleDb.OleDbConnection ob=new System.Data.OleDb.OleDbConnection();
ob.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=|DataDirectory|\ApecDB.mdb;";
Now create a command and add input parameter. Important thing to remember here, you can't insert the binary data using plain/string type sql query like
myCommand.ExecuteNonQuery("Update tblCompany SET "+column+"="+data+","+column+"_type="+type); this won't work at all. You must have to use parameter based command as like follows:
OleDbCommand myCommand = new OleDbCommand("Update tblCompany SET "+column+"=@img_stream,"+column+"_type=@img_type", ob);
// Mark the Command as a Text
myCommand.CommandType = CommandType.Text;
OleDbParameter img_stream = new OleDbParameter("@img_stream", OleDbType.Binary);
img_stream.Value = data;
myCommand.Parameters.Add(img_stream);
OleDbParameter img_Type = new OleDbParameter("@img_type", OleDbType.VarChar);
img_Type.Value = type;
myCommand.Parameters.Add(img_Type);
Then, its quite simple. open connection, execute query, close connection. If rows affected, then query successfull, return true, otherwise return false.
int affectedRows;
try
{
ob.Open();
affectedRows = myCommand.ExecuteNonQuery();
ob.Close();
}
catch (Exception exc)
{
return false;
}
if (affectedRows > 0)
{
return true;
}
else
{
return false;
}
Retrieving Image from Access Database using Asp.net/C#:
Retrieving image is quite easy compared to saving after using normal select query you have to define the content type & cast the data to byte & write it as Binary stream as follows:
Response.ContentType = dataRow["img_type"].ToString();
byte[] imageData = (byte[])dataRow[0]["img"];
Response.BinaryWrite(imageData);
You will find a working example on the following link that I found elsewhere:
http://rapidshare.com/files/289324545/InsertShowImageAccessDatabseAsp.netC_.rar.html
Also Remember:
* all image type isn't supported, so sometimes some are saved as "application/octetstream". they won't be retrieved in normal ways. You have to make a bitmap object from those kind og images & save them to database for retrieving them well. The follwing code snippet will show you how to make new image of another type:
Image originalImage = Image.FromStream(stream,true,true);
Bitmap targetImage = new Bitmap(originalImage, width, height);
with it, you can also resize an image to another size with custom width & height.
I upgraded my firefox to latest 3.5.x version. But, from after upgrading it, I got a problem, right mouse click doesn't work. After a while, I found the solution. The problem was causing by one addon which is 'yahoo toolbar'. after uninstalling it & restart my browser, it started working again perfectly. Thinking, yahoo toolbar need to be upgraded to be compatible with latest firefox or need vice-versa, :) ?
Subscribe to:
Posts (Atom)





