Wednesday, March 28, 2012

Make image proportionately small from url link asp.net

int width = 0;
int height = 0;

//
var webClient = new System.Net.WebClient();
byte[] image = webClient.DownloadData("http://static.livedemo00.template-help.com/wt_38438/images/page4_img2b.jpg");
//

//byte[] image = FileUpload1.FileBytes;

Int32.TryParse("100", out width);
Int32.TryParse("100", out height);
ImageHandler imageHandler = new ImageHandler();
bool maintainAR = true;
//calling CreateThumbnail Method to create thumb images
//it returns Bitmap Image.
Bitmap bmp = imageHandler.CreateThumbnail(image, maintainAR, width, height);
if (bmp != null)
{
//creating a file name with guid.
string fileName = Guid.NewGuid().ToString() + ".jpg";
//saving in current root folder.
bmp.Save(Server.MapPath(fileName));
//set image controls ImageUrl to saved Image, this is to view the thumbnail image
Image1.ImageUrl = fileName;
}
else
{
//exception part
if (imageHandler.havException)
{
Response.Write(imageHandler.ExceptionMessage);
}
}

Tuesday, March 27, 2012

Image upload through FCK editor - Solution

Steps to make it working.

1. Add





in web.config file.

this path represents the path you want are uploading the image

2. change

var _FileBrowserLanguage = 'aspx'; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx'; // asp | aspx | cfm | lasso | perl | php | py

in fckconfig.js file. for .net only.

3. put the absolute path like

UserFilesAbsolutePath = "C:\\Users\\soumen\\Desktop\\web\\fckeditor\\editor\\images\\UserFilesUpload";


in connector.aspx under "\fckeditor\editor\filemanager\connectors\aspx"

Monday, March 19, 2012

http://biggani.com

http://biggani.com

Encode decode in PHP



class Encryption {
var $skey = "kuntal"; // you can change it

public function safe_b64encode($string) {

$data = base64_encode($string);
$data = str_replace(array('+','/','='),array('-','_',''),$data);
return $data;
}

public function safe_b64decode($string) {
$data = str_replace(array('-','_'),array('+','/'),$string);
$mod4 = strlen($data) % 4;
if ($mod4) {
$data .= substr('====', $mod4);
}
return base64_decode($data);
}

public function encode($value){

if(!$value){return false;}
$text = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv);
return trim($this->safe_b64encode($crypttext));
}

public function decode($value){

if(!$value){return false;}
$crypttext = $this->safe_b64decode($value);
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv);
return trim($decrypttext);
}
}

?>

seo free article sub mission directory

http://pravalikadesigns.com/articles-sites-list.html

Tuesday, February 14, 2012

Only digit in text box in vb.net

Public Function TrapKey(ByVal KCode As String) As Boolean

If (KCode >= 48 And KCode <= 57) Or KCode = 8 Or KCode = 46 Then

'The AsCII values for numbers are between 48 to 57 and ASCII value 8 is for BackSpace.

TrapKey = False

Else

TrapKey = True

End If

End Function

Monday, January 23, 2012

Populate Tree view in vb.net from data base(parent child realation)

Private Sub Filltree()
Dim DSNWind As DataSet


Dim oRead As System.IO.StreamReader
Dim EntireFile As String
oRead = IO.File.OpenText(Application.StartupPath() + "/connection.txt")
EntireFile = oRead.ReadToEnd()
'end soumen
Dim connectionString As String = EntireFile
Dim conn As New SqlConnection(connectionString)
Dim dadagdetails As New SqlDataAdapter("select dd.dagdeatilsid,'Land type--'+l.landtype+',Satak--'+cast(dd.quantity as varchar) as [Details]from tblDagdetails as dd inner join tbllandtype as l on dd.landtype=l.landtypeid where dd.dagid='" + cmbDag.SelectedValue.ToString() + "'", conn)
Dim daowner As New SqlDataAdapter("select * from tblowner ", conn)
Dim daownerrealation As New SqlDataAdapter("select * from tblOwner", conn)
DSNWind = New DataSet

dadagdetails.Fill(DSNWind, "dagdetails")
daowner.Fill(DSNWind, "owner")
daownerrealation.Fill(DSNWind, "ownerrealation")


'DSNWind = New DataSet()
' DSNWind = db.GetDataSet("select dd.dagdeatilsid,'Land type--'+l.landtype+',Satak--'+cast(dd.quantity as varchar) as [Details]from tblDagdetails as dd inner join tbllandtype as l on dd.landtype=l.landtypeid where dd.dagid='" + cmbDag.SelectedValue.ToString() + "'", "dagdetails")
' DSNWind = db.GetDataSet("select * from tblowner ", "owner") 'where dagdetailsid=
' DSNWind = db.GetDataSet("select * from tblOwner ", "ownerrealation") 'where


'Create a data relation object to facilitate the relationship between the Customers and Orders data tables.
DSNWind.Relations.Add("tblDagdetails", DSNWind.Tables("dagdetails").Columns("dagdeatilsid"), DSNWind.Tables("owner").Columns("dagdetailsid"))
DSNWind.Relations.Add("tblOwner", DSNWind.Tables("owner").Columns("ownerid"), DSNWind.Tables("ownerrealation").Columns("parentid"), False)
'''''''''''''''''''''''


TreeView1.Nodes.Clear()
Dim i, n As Integer
Dim parentrow As DataRow
Dim ParentTable As DataTable
ParentTable = DSNWind.Tables("dagdetails")

For Each parentrow In ParentTable.Rows
Dim parentnode As TreeNode
parentnode = New TreeNode(parentrow.Item(1))
TreeView1.Nodes.Add(parentnode)
''''populate child'''''
'''''''''''''''''''''''
Dim childrow As DataRow
Dim childnode As TreeNode
childnode = New TreeNode()
For Each childrow In parentrow.GetChildRows("tblDagdetails")
childnode = parentnode.Nodes.Add(childrow(3)) ' & " " & childrow(1) & " " & childrow(2))
childnode.Tag = childrow("dagdetailsid")
''''populate child2''''
''''''''''''''''''''''''''
Dim childrow2 As DataRow
Dim childnode2 As TreeNode
childnode2 = New TreeNode()
For Each childrow2 In childrow.GetChildRows("tblOwner")
childnode2 = childnode.Nodes.Add(childrow2(3))

Next childrow2
''''''''''''''''''''''''

Next childrow
'''''''''''''''
Next parentrow

End Sub