Wednesday, May 27, 2009

Free Online Meta Tag Creator

Meta Tags are HTML header part tags, which describe about the website . These meta tags provide information to the search engines such as Google, Yahoo, MSN Search, AOL Search, AltaVista ,HotBot, Lycos, Excite and other search engines .

It is very important to the search engine point of view meta tags must be well formed and meaningful . HTML Meta tags help to increase your website rank. The common questions arise for meta tags are as follows?

What Are META Tags?
META Tags are HTML header part tags of HTML Document that provide internal & external information about the content of a web page or website while you are browsing that page you are not able to see that Meta tags on your browser output.



How META Tags Work for Search Engine?
Meta tag tell to search about the page such as keywords, Description, Content Language etc, which parameter you put in contents attribute of the meta tags that's is read by search engine to index your page with accuracy, which is totally depend to your passed paramenter in contents attributes.

Why Should I Use META Tags?
Meta Tags useful to control you website or webpage position or rank in search result such as Google, Yahoo, MSN search engine result etc. To your keywords & description basises search engine help to increase traffic on your website or web page. But it's very important to you put appropriate keywords and description according to you website or webpage contents.




About The Meta Tag Creator Application.

This Meta Tag Builder or Meta Tag Creator or Meta Tag Genrator or Meta Tag Maker simply build in Javascript. This does not store any information what you enter at time of generating meta tag so comments us. click to launch - Online Meta Tag Creator



Monday, May 18, 2009

CPU usage command for ubuntu server

To find out cpu usage.

top -n 1 | grep "Cpu"

Use FilterFunction in Flex ArrayCollection

Here is the simple Flex ArrayCollection FilterFunction example to ignore blank records (name) form arrayCollection.


var ac=new ArrayCollection();
ac.addItem({name:'abc'});
ac.addItem({name:'xyz'});
ac.addItem({name:''});
ac.addItem({name:'dac'});

// use of fillter function
ac.filterFunction = function(item:*):Boolean{
return (StringUtill.trim(item.name)!=""); //
}
ac.refresh();



Now filtered ArrayCollection object use further code.

Set Script Timeout In PHP

In PHP.ini define a script timeout (max_execution_time) if it's exceed , the script returns a fatal error. The default limit is 30 seconds. to set script max execution time we can use below function.



set_time_limit(1000) //1000 seconds

OR

ini_set("max_execution_time","1000"); //1000 seconds

Sunday, May 17, 2009

How to add SCRIPT Tag in Javascript

How to add SCRIPT Tag into Javascript or js file here is the simple example to embed Javascript into Javascript.

function addJavaScriptTag(){

return "<\script language='javascript'>alert('hi..')<\/script>";

}

Friday, May 15, 2009

C Sharp User Define SQL Database Class

This is the simple user define SQL Database Class. It is useful to avoid redundancy of the code.


Database Class In C#
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public class _Database
{
public SqlConnection con;
public SqlCommand com = null;
public SqlDataReader dr = null;
public SqlDataAdapter da = null;
public DataSet ds = null;
public String glQuery = "";
public String glnonQuery = "";
public const int EXECUTE_NONE_QUERY = 1;
public const int EXECUTE_QUERY = 2;
public const int DATA_ADAPTER = 3;

// connection for data list paging
public SqlConnection globalcon = new SqlConnection("server=**;uid=**;pwd=***;Database=**");
public _Database() { }
public void Query(String SqlQuery)
{
this.glQuery = this.Get_DataBasePrefix(SqlQuery);
}
private String Get_DataBasePrefix(String str)
{
return str.Replace("#__", "GD_").ToString();
}
public void ConnectDB()
{
try
{
con = new SqlConnection();
con.ConnectionString = "server=*****;uid=**;pwd=****;Database=***";
con.Open();
}
catch (Exception ex)
{
}
}
public void CloseDB()
{
this.con.Close();
this.con.Dispose();
}
public bool Read()
{
return this.dr.Read();
}
public void ExecuteQuery(int Mode)
{
try
{
if (Mode == EXECUTE_NONE_QUERY) // Excutenonequery
{
this.com = new SqlCommand(this.glQuery, this.con);
this.com.ExecuteNonQuery();
}
else if (Mode == EXECUTE_QUERY) // Execute Query
{
this.com = new SqlCommand(this.glQuery, this.con);
this.dr = this.com.ExecuteReader();
}
else if (Mode == DATA_ADAPTER) // Data Adapter
{
this.da = new SqlDataAdapter(this.glQuery, this.con);
this.ds = new DataSet();
this.da.Fill(this.ds);
}
}
catch (Exception ex)
{
}
}
public bool HasRows()
{
if (this.dr.HasRows)
{
return true;
}
else
{
return false;
}

}
}

Tuesday, May 12, 2009

FTP File Uploading Using C Sharp

This is the example to upload file using FTP Web Request.


using system.net;
using system.io;

FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create("ftp://myDoc.com/xyz.pdf"); /
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(username, password);
request.UsePassive = true;
request.UseBinary = true;
request.KeepAlive = false;

//Load the file
FileStream stream = File.OpenRead(filePath); //c:/myDoc/xyz.pdf
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
stream.Close();

//Upload file
Stream reqStream = request.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
btnUpload.UseWaitCursor = false;

Monday, May 11, 2009

Create XML File From Mysql Table

How to create XMLFile Form Mysql Table


function createXMLFile($result, $feildLength, $dir) {
$headers = array();
$xmlData = array();
$str = "";
$counter = 0;

for ($i=0;$i<$feildLength;$i++) {
array_push($headers, mysql_field_name($result, $i));
}
$xmlFileData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
while ($row = mysql_fetch_array($result)) {
for ($i=0;$i<$feildLength;$i++) {
$str .= "<".trim($headers[$i]).">" . escapeXMLEntities(trim($row[$i])) . "</".trim($headers[$i]).">\n";
$counter++; //increment column#
if ($counter == $feildLength) { //new row
array_push($xmlData, "<record>\n" . $str . "</record>\n");
$str = "";
$counter = 0;
}
}
}
$xmlFileData .= "<records name=\"Customer_Table\">\n" . implode("", $xmlData) . "</records>";


$f = fopen($dir."xmlDataFile.xml", 'w+') or die("Can not create file: xmlDataFile.xml");
fwrite($f, $xmlFileData);
fclose($f);
}


function escapeXMLEntities($xml) { // this will escape xml entities

$xml = str_replace("&", "&", $xml);
$xml = str_replace("<", "<", $xml);
$xml = str_replace(">", ">", $xml);
$xml = str_replace("\"", """, $xml);
$xml = str_replace("'", "'", $xml);

return $xml;
}

# Call this function

createXMLFile(mysql_query('select * from Customer'), 10, "/Folder/");


Creating Data Grid Using HTTP Service in Flex

Creating Data Grid Using HTTP Service in Flex & displaying data using XML in flex.



<?xml version='1.0' />
<Data>
<ID>1</ID>
<Name>Vineet</Name>
</Data>
<Data>
<ID>2</ID>
<Name>Abhishek</Name>
</Data>


This Data Grid Example will display above xml data in grid.


<mx:application mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationcomplete="init()">

<mx:httpservice id="xmlFile" url="http://localhost/***/***/project.php" result="getXML(event)" resultformat="e4x" />
<mx:script>

<!--[CDATA[
import mx.rpc.events.ResultEvent;
[Bindable]
-->
</mx:script>

<mx:panel x="10" y="10" width="100%" height="100%">
<mx:canvas label="XYZ" width="100%" height="100%">
<mx:datagrid x="10" y="10" width="100%" height="100%" dataprovider="{xmlHandler}">
<mx:columns>
<mx:datagridcolumn width="82" headertext="ID" datafield="ID">
<mx:datagridcolumn headertext="name" datafield="Name">
</mx:datagridcolumn>
</mx:datagridcolumn>
</mx:columns>
</mx:datagrid>

</mx:canvas>
</mx:panel>
</mx:application>

Drawing Line and arrow using flex

How to drawing line with arrow in flex?

public function addPoint(sX:int,sY:int,eX:int,eY:int,
createArrow:Boolean):void
{
var g:Graphics =this.graphics;
g.lineStyle(1, 0xff0000, 1);
g.moveTo(sX, sY);
g.lineTo(eX, eY);

if(createArrow){// drawing arrow
g.lineStyle(6, 0x0000ff, 1);
g.moveTo(Math.round(eX+((sX-eX)/6)),
Math.round(eY+((sY-eY)/6))); // mid point
g.lineTo(eX, eY);
g.lineStyle(3, 0x00ff00, 1);

g.moveTo(Math.round(eX+((sX-eX)/6)),
Math.round(eY+((sY-eY)/6))); // mid point

g.lineTo(eX, eY);
}
}

Using Date Feild in Flex.

How to use Date Feild in flex ?


<mx:application mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:datefield x="25" y="68" width="217" height="40">
</mx:datefield>
</mx:application>

How to use Accordion window in Flex


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel x="119" y="63" width="382" height="268" layout="absolute" title="Accordion select">
<mx:HBox width="100%" height="100%" id="hbox6">
<mx:Accordion width="100%" height="100%">
<mx:Canvas width="100%" label="Accordion 1">
</mx:Canvas>
<mx:Canvas width="100%" label="Accordion 2">
</mx:Canvas>
<mx:Canvas width="100%" label="Accordion 3">
</mx:Canvas>
<mx:Canvas width="100%" label="Accordion 4">
</mx:Canvas>
</mx:Accordion>
</mx:HBox>
</mx:Panel>
</mx:Application>

How to use Color Picker in flex


<mx:application mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:panel x="80" y="30" width="352" height="200" layout="absolute">
<mx:colorpicker x="74" y="34" width="121">
</mx:colorpicker>
</mx:panel>
</mx:application>

Get Page URL in Flex

How do i get flex html page url & how can use query string ?


mx.core.Application.application.url


Above property return query string & url which we can use in flex code.

Read Mulitiple selected item of List Box Using Flex

How to read multiple selection list box in flex?

<mx:List allowMultipleSelection="true"
id="searchResult" width="100%"
height="100"
verticalScrollPolicy="on"
click="filter">

<mx:dataProvider>
<mx:Object label="Schmidt, Frank" value="1"/>
<mx:Object label="Schmidt, Peter" value="2"/>
</mx:dataProvider>
</mx:List>


function filter():void{
var str:String="";
for each(var ob:Object in searchResult.selectedItems){
str+=(str=="")?ob.value.toString():","+ob.value.toString();
i++;
}
trace(str); // this will return you indexs of list box
}

Sunday, May 10, 2009

Send Mail Using ASP.net and C Sharp

This class is useful to send email using ASP.NET and C-Sharp.


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public class _Mail
{
string host = "xxx.xxxx.com";
string userid = "xxx@xxxx.com";
string password = "*****";
string from = "xxx@xxxxx.com";

string to = null;
string subject = null;
string msg = null;



public _Mail(String to,String from,String userid,String password,String subject,String msg)
{
this.to = to;
if (userid == null && password == null)
{
this.userid = this.userid;
this.password = this.password;
}
else
{
this.userid = userid;
this.password = password;
}
if (from == null)
{
this.from = this.from;
}
else
{
this.from = from;
}
this.subject = subject;
this.msg = msg;
}
public void SendMail()
{
System.Net.Mail.MailMessage email = null;
email = new MailMessage(this.from,this.to);
email.Subject = this.subject;
email.Body = this.msg;
SmtpClient mailClient = null;
mailClient = new SmtpClient();
System.Net.NetworkCredential basicAuthenticationInfo = null;
basicAuthenticationInfo = new System.Net.NetworkCredential(this.userid,this.password);
mailClient.Host = this.host;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = basicAuthenticationInfo;
mailClient.Send(email);
}
}

How To Check Length Using ereg function

Check length of string using ereg php function



$str = "1234";
if(ereg([0-9]{4}, $str)) {

pirint "Matched";

}