Thursday, August 6, 2009

Replace Character Codes using PHP.

How to replace character codes for german using str_replace php function. Characters such as :

ä
Ä'
é
ö
Ö
ü
Ü
Other chars.

see simple example.

 <?php
$find ="ü";
$rep = "u";
$str = "aüstin";
echo str_replace($find,$rep,utf8_encode($str));
?>

Friday, July 24, 2009

Convert excel to CSV file using PHP, Linx Server

How to convert xls file into csv file using php or LAMP, Look at simple example to convert excel to csv file using php on linux server.

 <?php
require_once 'Excel/reader.php';
$excel = new Spreadsheet_Excel_Reader();
$excel->setOutputEncoding('CP1251');
$excel->read('b.xls');
$x=1;
$sep = ",";
ob_start();
while($x<=$excel->sheets[0]['numRows']) {
$y=1;
$row="";
while($y<=$excel->sheets[0]['numCols']) {
$cell = isset($excel->sheets[0]['cells'][$x][$y]) ? $excel->sheets[0]['cells'][$x][$y] : '';
$row.=($row=="")?"\"".$cell."\"":"".$sep."\"".$cell."\"";
$y++;
}
echo $row."\n";
$x++;
}
$fp = fopen("data.csv",'w');
fwrite($fp,ob_get_contents());
fclose($fp);
ob_end_clean();
?>

You can download reader.php file from http://sourceforge.net/projects/phpexcelreader/

Thursday, July 23, 2009

Set php.ini values into .htaccess file

How can i set php.ini configuration values into .htaccess file? Here is the simple solution to set php.ini variables into .htaccess file.

Syntax non flag variables.
php_value setting_name setting_value

Example :
php_value upload_max_filesize 10M

Syntax for flag variables such as (on/off).
php_flag [variable_name] [value]


Exmaple :
php_flag register_globals off

Friday, June 26, 2009

Send HTML Form Elements Value Without Using Form Tag

How to send form components value without using Form Tag in HTML, ?
This example will help your to send HTML elements value from one page to another page without using HTML Form Tag.

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<script language="javascript">
function goFor(){
var ele = document.getElementById("URL");
if(ele.value==""){
alert("Please Enter URL.");
}else{
location.href="http://www.google.com?q="+ele.value;
}
}
</script>
<input id="URL" name="URL" type="text">
<input type="button" value="Go" onclick='goFor()'/>
</BODY>
</HTML>

Sunday, June 14, 2009

How to Replace All in Javascript

How to replace all string using javascript replace function... Here is simple example replace all in javascript in replace string method.

CODE:
  <Script Language="javascript">  
var str = "This is the test string.";
var rs = str.replace(/is/g,"");
document.write(st); // result "Th the test string."
</Script>

Saturday, June 13, 2009

How to send variables from on SWF flex file to another SWF file Using Flex.

How to Communicate From one SWF Flex file to another SWF Flex File ?

See the below example, This is loading external swf flex file into parent SWF File and sharing the data or variable from parent to child and child to parent.

Parent.mxml


CODE:
1:  <?xml version="1.0" encoding="utf-8"?>
2: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%">
3: <mx:Script>
4: <![CDATA[
5: import mx.events.CloseEvent;
6: import mx.controls.SWFLoader;
7: import mx.managers.PopUpManager;
8: import mx.containers.TitleWindow;
9: import mx.controls.Alert;
10:
11: public var tw:SWFPlaceHolder;
12:
13: public function launchExternalSWF(title:String,swfFilePath:String):void{
14:
15: // setting a variable for child SWF File
16: Application.application.parameters.childVar=txt.text;
17:
18: tw = PopUpManager.createPopUp(this,SWFPlaceHolder,true) as SWFPlaceHolder;
19: tw.title = title;
20: tw.width=600;
21: tw.height=400;
22: tw.launchSWF(swfFilePath);
23: }
24:
25: public function getValueFromChildSWF():void{
26: // geting value from child SWF File
27: Alert.show(Application.application.parameters.parentVar,"Parent App");
28: }
29: ]]>
30: </mx:Script>
31: <mx:VBox width="100%" height="100%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
32: <mx:HBox width="100%" horizontalAlign="center" verticalAlign="middle">
33: <mx:Label text="Set Value For Child SWF File " />
34: </mx:HBox>
35:
36: <mx:HBox width="100%" horizontalAlign="center" verticalAlign="middle">
37: <mx:TextArea id="txt" width="100%" height="200">
38: <mx:text>
39: Hello World for Child SWF.....
40: </mx:text>
41: </mx:TextArea>
42: </mx:HBox>
43: <mx:HBox width="100%" horizontalAlign="center" verticalAlign="middle">
44: <mx:Button label="Click to Lanuch External SWF File" id="btn" click="{this.launchExternalSWF('Launch Child SWF File','ExternalSWF.swf')}" />
45: <mx:Button label="Get Value From Child SWF File" id="btn1" click="{this.getValueFromChildSWF()}" />
46: </mx:HBox>
47: </mx:VBox>
48: </mx:Application>
49:



Here is another File for loading swf file SWFFilePlaceHolder.mxml


CODE:
1:  <?xml version="1.0" encoding="utf-8"?>
2: <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="500" creationComplete="{PopUpManager.centerPopUp(this)}" showCloseButton="true" close="{PopUpManager.removePopUp(this)}">
3: <mx:Script>
4: <![CDATA[
5: import mx.events.CloseEvent;
6: import mx.managers.PopUpManager;
7: import mx.controls.Alert;
8:
9: public function launchSWF(path:String):void{
10: swf.source = path;
11: this.addEventListener(CloseEvent.CLOSE,swfUnload);
12:
13: }
14:
15: public function swfUnload(evt:Event):void{
16: swf.source = null;
17: }
18: ]]>
19: </mx:Script>
20: <mx:SWFLoader id="swf" width="100%" height="100%" />
21: </mx:TitleWindow>
22:


This is The Child or External SWF Flex File Child.mxml

CODE:
1:  <?xml version="1.0" encoding="utf-8"?>
2: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="White">
3: <mx:Script>
4: <![CDATA[
5: import mx.controls.Alert;
6: public function getValueFromParentSWF():void{
7: Alert.show("Parent App Value:\n"+ Application.application.parameters.childVar,"Child SWF");
8: this.setValueForInternalSWF();
9: }
10:
11: public function setValueForInternalSWF():void{
12: Application.application.parameters.parentVar = txt.text;
13: }
14: ]]>
15: </mx:Script>
16: <mx:Panel label="Child App" width="100%" height="100%">
17: <mx:VBox width="100%" height="100%">
18: <mx:HBox width="100%" horizontalAlign="center" verticalAlign="middle">
19: <mx:Label text="Set Value For Parent SWF File " />
20: </mx:HBox>
21: <mx:HBox width="100%" horizontalAlign="center" verticalAlign="middle">
22: <mx:TextArea id="txt" width="100%" height="200" keyDown="setValueForInternalSWF()">
23: <mx:text>
24: Hello World for Parent SWF.....
25: </mx:text>
26: </mx:TextArea>
27: </mx:HBox>
28: <mx:HBox width="100%" horizontalAlign="center" verticalAlign="middle">
29: <mx:Button label="Click To Get Value From Parent App Textarea" click="getValueFromParentSWF()" />
30: </mx:HBox>
31: </mx:VBox>
32:
33: </mx:Panel>
34: </mx:Application>
35:

Friday, June 12, 2009

How To Read RSS Using PHP

Here is the simple code to read RSS Feeds using php with simpladxml_load_string function.

CODE:
1 :  <?php
2 :       $displayItems = 5;
3 :       $itemCounter = 0;
4 :       $rss = simplexml_load_file("http://put here url of RSS Feed");
5 :       foreach($rss->channel->item as $feeds){
6 :            $itemCounter++;
7 :            echo '<li><a href="'.$feeds->link.'">'.$feeds->title.'</a><br /><br />';
8 :            if($itemCounter==$displayItems)break;
9 :       }
10 :  ?>

Wednesday, June 10, 2009

How to Check Local Machine Name and IP Address Using C#

How to check client Machine or local Machine Name and IP address using C-sharp, See the below simple example code.


CODE:
1 : using System.Net;
2 :
3 : string hostName = Dns.GetHostName();
4 : IPHostEntry ie = Dns.GetHostByName(hostName);
5 : IPAddress[] ia= ie.AddressList;
6 :
7 : MessageBox.Show("Local Machine Name : "+hostName.ToString());
8 : MessageBox.Show("IP address Of Local Machine "+ipAddress[0].ToString());

How to Check Internet Connection Using C-Sharp

How to check internet connection using c#? Here is a simple example to find out internet connection or page response using c -Sharp

CODE:
1 : Using System.Net ;
2 : try{
3 : HttpWebRequest request= (HttpWebRequest) HttpWebRequest.Create("google.com");
4 : HttpWebResponse response= (HttpWebResponse) request.GetResponse();
5 : if (HttpStatusCode.OK == response.StatusCode)
6 : {
7 : //Write here your code...
8 : response.Close();
9 : }
10 : }catch (Exception ex){
11 : MessageBox.Show("Unable to connect");
12 : }

Monday, June 8, 2009

How to Format My Source Code For Blogger ?

How to format my source code for blogger, blog, Blogging, weblog & website ?

Now you can format you source code for blogger, blog, Blogging, weblog & website using online source code formatter. This application build in javascript. This source code beautifier or formatter provide for your blogger, Blog and websites a good code indentation. You can can format your source code with alternative background using <pre> tag. It does not add unnecessary tags in formatted source code excpet <pre> and <code> so just try onto your source code for blog or blogging & website posts . This is absolutly free online line source code formatter tool for your blogger & website.


See example..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
</BODY>
</HTML>

Friday, June 5, 2009

Flex Trim Function

Trim function of flex. You can use StringUtil Class to trim string and array elements.
See the below code.

StringUtil.trim(str:String);
StringUtil.trimArrayElements(value,delimiter);

Tuesday, June 2, 2009

Search Records into XML Using PHP

There is an example for search items or block into xml using php with simplexml_load_string method or function, this will return you record block for particular query.

query = us

CODE:
1 :  <?php
2 :       # parm query=delhi , us
3 :       $xmlStr = '<?xml version="1.0" encoding="utf-8"?>
4 :                           <temprature>
5 :                           <item>
6 :                                <city>Bareilly</city>
7 :                                <state>Uttar Pradesh</state>
8 :                                <country>India</country>
9 :                                <lat>32.4567</lat>
10 :                                <lon>34.4567</lon>
11 :                                <temp>43.0</temp>
12 :                           </item>
13 :                           <item>
14 :                                <city>Haldwani</city>
15 :                                <state>Uttarakhand</state>
16 :                                <country>India</country>
17 :                                <lat>33.4567</lat>
18 :                                <lon>34.4567</lon>
19 :                                <temp>44.0</temp>
20 :                           </item>
21 :                           <item>
22 :                                <city>Delhi</city>
23 :                                <state>Delhi</state>
24 :                                <country>India</country>
25 :                                <lat>35.4567</lat>
26 :                                <lon>36.4567</lon>
27 :                                <temp>45.0</temp>
28 :                           </item>
29 :                           <item>
30 :                                <city>Jaipur</city>
31 :                                <state>Rajasthan</state>
32 :                                <country>India</country>
33 :                                <lat>36.4567</lat>
34 :                                <lon>37.4567</lon>
35 :                                <temp>48.0</temp>
36 :                           </item>
37 :                           </temprature>';
38 :       $xmlo = simplexml_load_string($xmlStr);
39 :       $i=0;
40 :       foreach($xmlo->item as $c){
41 :            foreach($c->children() as $ch){
42 :                 if(strtolower($ch) == strtolower($_GET["query"])){
43 :                      @header("content-type: text/xml");
44 :                      echo $xmlo->item[$i]->asXML();
45 :                      exit;
46 :                 }
47 :            }
48 :            $i++;
49 :       }
50 :       @header("content-type: text/xml");
51 :       echo "<Error>No item found!</Error>";
52 :       exit;
53 :  ?>

Center Alignment of popup window Javascript

How to centralized popup window using Javascript. see the below code.

CODE:
1 :  var OpenWindows = new Object();
2 :  function OpenWin(sPath, w, h)
3 :   {
4 :       l = (screen.width - w)/2-5;
5 :       t = (screen.height - h)/2-20;
6 :       if (l<1) l=0;
7 :       if (t<1) t=0;
8 :       sWindowName = "mainwin_" + w + "_" + h;
9 :       if(OpenWindows[sWindowName]) {
10 :            if(!OpenWindows[sWindowName].closed) OpenWindows[sWindowName].close();
11 :       }
12 :       OpenWindows[sWindowName] = window.open(sPath, sWindowName, "left=" + l + ",top=" + t + ",width=" + w + ",height=" + h + ",scrollbars=no,menubar=no,toolbars=no,status=no");
13 :       return OpenWindows[sWindowName];
14 :  }

How To Change Form Action at Runtime

How to change Form action at runtime using javascript. This the example which will change html form action at runtime.

CODE:
1 :  <html>
2 :  <head>
3 :  <Script Language="javascript">
4 :  function change_action(){
5 :  var frm_obj=document.getElementById("frm");
6 :  frm_obj.action="http://www.google.com";
7 :  }
8 :  </Script>
9 :  </head>
10 :  <body>
11 :  <form id="frm" action="abc.php" method="post" onsubmit="return change_action()">
12 :  UID &nbsp;&nbsp;<input type="text"><br>
13 :  PWD <input type="Password"><br><br>
14 :  <input type="submit" value="submit">
15 :  </form>
16 :  </body>
17 :  </html>

Change Div Position Randomly on Home Page

Change Div position randomly on home page.here is simple example which display a div randomly on homepage within available width and hight.


CODE:
1 :  <Script Langauge="javscript">
2 :  var load=true;
3 :  var div_width=300;
4 :  var div_height=200;
5 :  var top=Math.floor(Math.random()*screen.availHeight - div_height)
6 :  var left=Math.floor(Math.random()*screen.availWidth - div_width)
7 :  document.write("<div id='pic_div' style='border:1px solid black;position:absolute;width:"+div_width+";height:"+div_height+";
8 :  text-align:center;left:0px;top:0px'>a</div>");
9 :  var d_obj=document.getElementById("pic_div");
10 :  d_obj.style.top=top;
11 :  d_obj.style.left=left;
12 :  </script>

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";

}

Friday, April 3, 2009

Create Word Document Using PHP

Here is the example of creating word document using php.
<?php
$wordObj = new COM("word.application") or die ("Could not create an instance of word");
echo "Version : {$wordObj->version}";
$wordObj->visible = 1;
$wordObj->Documents->Add();
$wordObj->Selection->TypeText("Hello World.."); // add text here
$wordObj->Documents[1]->SaveAs("sample.doc"); // save location
$wordObj->Quit();
$wordObj->Release(); //free object
$wordObj = null;
?>

Wednesday, April 1, 2009

How to set PHP Cookie for Domain

setcookie("CookieName","cookieValue"," expire","directory path ","Domain name");
Example :

setcookie("TestCookie","hi", time()+3600,"/dir1/dir2/","mytest.com");

How to set Javascript Cookie for Domain

var cookie_date = new Date ( ); // current date & time
cookie_date.setTime ( cookie_date.getTime() + 24*60*60*1000 ); // for 1 days


Syntax:
document.cookie = "CookieName=CookieValue; expires=cookie expire time"; path= directories;domain=domainname";

Example:
document.cookie="test=testValue;expires="+ cookie_date.toGMTString()+";path=/dir1/dir2/dir3/;domain=mytest.com";

Tuesday, March 31, 2009

Remove Query String Using Regular Expressions

You can use this code to remove query string from URL.

<?php
$url = "http://www.testDomain.com/testPage.php?q1=queryString1&q2=queryString2";

$search = '|(\.php)(.*)|i';
$replace = '${1}';

echo preg_replace( $search, $replace, $url );

?>

Convert Image Into Jpeg Using C sharp.

This example is useful to upload image of any format and Convert into JPEG or JPG Using C-Sharp.
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.Drawing.Drawing2D;

public class _Library
{
public string w;
public string h;
public _Library()
{

}

/* for uploading Image */
public String UploadFile(FileUpload Fileobject,String Path)
{
String FileName = "";
String[] getformat;
String imgformat1 = "", imgformat2 = "";
if (Fileobject.HasFile)
{
FileName = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + "_" + Fileobject.FileName.Replace(' ','-').ToLower();

Fileobject.SaveAs(@"" + Path + "" + FileName);
getformat =FileName.ToString().Split('.');
imgformat1 = getformat[0].ToString();
imgformat2 = getformat[1].ToString();

if (imgformat2.ToString().Equals("jpg"))
{
}
else
{
FileName = ConvertIntoJPEG(Path + "" + FileName);
}
}
return FileName;
}
public void UploadFile(FileUpload Fileobject, String NewFilePath, String NewFileName)
{
String FileName = "";
if (Fileobject.HasFile)
{
//FileName = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + "_" + Fileobject.FileName.Replace(' ', '-').ToLower();
Fileobject.SaveAs(@"" + NewFilePath + "" + NewFileName);
FileName = ConvertIntoJPEG(NewFilePath + "" + NewFileName);

}
}
public bool ThumbnailCallback()
{
return false;
}
public void ImageResizeHigherSide(String Source_Desti,int image_higher_size)
{
String source = Source_Desti;
String desti = Source_Desti + "._tmpfile";
String Del_abspath = source;
Bitmap myBitmap = new Bitmap(source);
int higher_size = image_higher_size;
int h_w_n_h = 0;
int n_w = 0;
int n_h = 0;
int o_w = myBitmap.Width;
int o_h = myBitmap.Height;
if (o_w > higher_size || o_h > higher_size)
{
if (o_w > o_h)
{
n_w = higher_size;
n_h = o_h * higher_size / o_w;
}
else
{
n_h = higher_size;
n_w = o_w * higher_size / o_h;
}
try
{
//getting higher size of image
if (o_w > o_h) h_w_n_h = o_w;
else h_w_n_h = o_h;
if (image_higher_size > h_w_n_h)
{
n_h = o_h;
n_w = o_w;
}
System.Drawing.Image.GetThumbnailImageAbort myCallback = new System.Drawing.Image.GetThumbnailImageAbort(this.ThumbnailCallback);
System.Drawing.Image myThumbnail = myBitmap.GetThumbnailImage(n_w, n_h, myCallback, IntPtr.Zero);
////myBitmap.SetResolution(100, 100);
Graphics myresizer;
myresizer = Graphics.FromImage(myThumbnail);
myresizer.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
myresizer.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
myresizer.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
myresizer.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

//////myresizer.DrawImage(myBitmap, new Rectangle(0, 0, n_w, n_h), 0, 0, n_w, n_h, GraphicsUnit.Pixel);
myresizer.DrawImage(myBitmap, 0, 0, n_w, n_h);
// myBitmap.Save(desti, ImageFormat.Jpeg);
myThumbnail.Save(desti, ImageFormat.Jpeg);
myresizer.Dispose();
myThumbnail.Dispose();
myBitmap.Dispose();
File.Delete(source);
File.Move(desti,desti.Replace("._tmpfile", ""));
File.Delete(desti);
}
catch (Exception ex){}
}
}


private String ConvertIntoJPEG(String Source_Desti)
{
String source = Source_Desti;
String ext = source.Substring(source.LastIndexOf('.'));
String desti = source;
desti = desti.Replace(ext, ".jpg");
desti = desti + "._tmpfile";
String nJpegFileName = "";
String Del_abspath = source;
Bitmap myBitmap = new Bitmap(source);

int o_w = myBitmap.Width;
int o_h = myBitmap.Height;
try
{
System.Drawing.Image.GetThumbnailImageAbort myCallback =
new System.Drawing.Image.GetThumbnailImageAbort(this.ThumbnailCallback);
System.Drawing.Image myThumbnail = myBitmap.GetThumbnailImage(o_w, o_h, myCallback, IntPtr.Zero);


Graphics myresizer;
myresizer = Graphics.FromImage(myThumbnail);
myresizer.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
myresizer.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
myresizer.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
myresizer.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

//////myresizer.DrawImage(myBitmap, new Rectangle(0, 0, n_w, n_h), 0, 0, n_w, n_h, GraphicsUnit.Pixel);
myresizer.DrawImage(myBitmap, 0, 0, o_w, o_h);

myThumbnail.Save(desti, ImageFormat.Jpeg);
myThumbnail.Dispose();
myBitmap.Dispose();
File.Delete(source);
File.Move(desti, desti.Replace("._tmpfile", ""));
File.Delete(desti);
}
catch (Exception ex)
{

}
desti = desti.Replace("._tmpfile", "");
nJpegFileName = desti.Substring(desti.LastIndexOf("\\") + 1);
return nJpegFileName;
}
/* For deleting Image from Folder*/
public void DeleteFile(String Del_abspath)
{
if (Del_abspath != null)
{
try
{
String delpath = Del_abspath.Replace('\\', '/');
File.Delete(delpath);
}
catch (Exception ex) { }

}
}
}

Wednesday, March 18, 2009

Flex Banner Example

Simple Flex Fade in Fade out Banner Example

CODE:
1:  <?xml version="1.0" encoding="utf-8"?>
2: <mx:Application verticalScrollPolicy="off" verticalGap="0" horizontalGap="0" horizontalScrollPolicy="off" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" paddingTop="0" paddingLeft="0" paddingRight="0" paddingBottom="0" verticalAlign="middle" backgroundColor="white" creationComplete="{init();}">
3: <mx:Script>
4: <![CDATA[
5: import mx.effects.WipeLeft;
6: import mx.events.TweenEvent;
7: import mx.controls.Alert;
8: import mx.events.EffectEvent;
9: import mx.effects.Fade;
10: import mx.effects.Pause;
11: import mx.effects.Sequence;
12: import mx.effects.SetPropertyAction;
13: import mx.effects.WipeRight;
14: private var fader:Sequence;
15: private var wiper:Sequence;
16: public var wipeIn:WipeRight;
17: public var wipeOut:WipeLeft;
18: public var pause:Pause;
19: public var alphaOn:SetPropertyAction;
20: public var alphaOff:SetPropertyAction;
21: private var counter:int=1;
22: [Bindable]
23: private var imagesArr:Array =
24: [
25: "image1.jpg",
26: "image3.jpg",
27: "image4.jpg"
28: ];
29: public function init():void{
30: // for preloading image
31: var img:Image = new Image();
32: for(var i:int=0;i<imagesArr.length;i++){
33: img.source = "images/"+imagesArr[i];
34: }
35: start_wipe();
36: }
37: private function start_wipe():void {
38: wipeIn = new WipeRight();
39: wipeIn.showTarget = true;
40: wipeIn.duration = 3000;
41: wipeOut = new WipeLeft();
42: wipeOut.showTarget = false;
43: wipeOut.duration = 2000;
44: pause = new Pause();
45: pause.duration = 5000;
46: alphaOn = new SetPropertyAction();
47: alphaOn.name = "alpha";
48: alphaOn.value = 1.0;
49: alphaOff= new SetPropertyAction();
50: alphaOff.name = "alpha";
51: alphaOff.value = 0.0;
52: wiper = new Sequence();
53: wiper.addChild(alphaOn);
54: wiper.addChild(wipeIn);
55: wiper.addChild(pause);
56: wiper.addChild(wipeOut);
57: wiper.addChild(alphaOff);
58: wiper.stop();
59: wiper.play([imagePlaceHolder]);
60: wiper.addEventListener(EffectEvent.EFFECT_END,wiperEffectEnd);
61: }
62: public function wiperEffectEnd(evt:EffectEvent):void{
63: var len:int=imagesArr.length;
64: if(len==counter) counter=0;
65: img.source= "images/"+imagesArr[counter];
66: counter++;
67: this.start_wipe();
68: }
69: ]]>
70: </mx:Script>
71: <mx:HBox horizontalGap="0" verticalGap="0" id="imagePlaceHolder" width="100%" height="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="#E6E6E6" alpha="0.0" paddingTop="0" paddingLeft="0" paddingRight="0" paddingBottom="0">
72: <mx:Image source="images/image1.jpg" id="img" />
73: </mx:HBox>
74: </mx:Application>

Monday, March 16, 2009

R Script Command Line Options

Usage: R [options] [<> outfile]
or: R CMD command [arguments]

Start R, a system for statistical computation and graphics, with the
specified options, or invoke an R tool via the 'R CMD' interface.

Options:

-h, --help : Print short help message and exit
--version : Print version info and exit
--encoding=ENC : Specify encoding to be used for stdin
RHOME : Print path to R home directory and exit
--save : Do save workspace at the end of the session
--no-save : Don't save it
--no-environ : Don't read the site and user environment files
--no-site-file : Don't read the site-wide Rprofile
--no-init-file : Don't read the .Rprofile or ~/.Rprofile files
--restore : Do restore previously saved objects at startup
--no-restore-data : Don't restore previously saved objects
--no-restore-history : Don't restore the R history file
--no-restore : Don't restore anything
--vanilla : Combine --no-save, --no-restore, --no-site-file, --no-init-file and --no-environ
--no-readline : Don't use readline for command-line editing
--min-vsize=N : Set vector heap min to N bytes; '4M' = 4 MegaB
--max-vsize=N : Set vector heap max to N bytes;
--min-nsize=N : Set min number of cons cells to N
--max-nsize=N : Set max number of cons cells to N
--max-ppsize=N : Set max size of protect stack to N
-q, --quiet : Don't print startup message
--silent : Same as --quiet
--slave
: Make R run as quietly as possible
--verbose
: Print more information about progress
-d, --debugger=NAME
: Run R through debugger NAME
--debugger-args=ARGS
: Pass ARGS as arguments to the debugger
-g, --gui=TYPE
: Use TYPE as GUI; possible values are 'X11'
(default), 'Tk' and (with package gnomeGUI) 'gnome'
--arch=NAME
: Specify a sub-architecture
--args
: Skip the rest of the command line
-f, --file=FILE
: Take input from 'FILE'Commands:

BATCH : Run R in batch mode
COMPILE : Compile files for use with R
SHLIB : Build shared library for dynamic loading
INSTALL : Install add-on packages
REMOVE : Remove add-on packages
build : Build add-on packages
check : Check add-on packages
LINK : Front-end for creating executable programs
Rprof : Post-process R profiling files
Rdconv : Convert Rd format to various other formats
Rd2dvi : Convert Rd format to DVI/PDF
Rd2txt : Convert Rd format to pretty text
Sd2Rd : Convert S documentation to Rd format
Stangle : Extract S/R code from Sweave documentation
Sweave : Process Sweave documentation
config : Obtain configuration information about R

Open Babel command line options

Open Babel command line options are as follows.

Open Babel converts chemical structures from one file format to another

Usage: babel <input> <output> [Options]

Each spec can be a file whose extension decides the format.
Optionally the format can be specified by preceding the file by
-i<format-type>&e.g. -icml, for input and -o<format-type> for output

See below for available format-types, which are the same as the
file extensions and are case independent.
If no input or output file is given stdin or stdout are used instead.

More than one input file can be specified and their names can contain
wildcard chars (* and ?).The molecules are aggregated in the output file.

Conversion options

-f <#> Start import at molecule # specified
-l <#> End import at molecule # specified
-e Continue with next object after error, if possible
-z Compress the output with gzip
-k Attempt to translate keywords
-H Outputs this help text
-Hxxx (xxx is file format ID e.g. -Hcml) gives format info
-Hall Outputs details of all formats
-V Outputs version number
-L <basetype> Lists plugin classes of this type
e.g. <fingerprints>, or <plugins> for a list of BaseTypes
-m Produces multiple output files, to allow:
Splitting: e.g. babel infile.mol new.smi -m
puts each molecule into new1.smi new2.smi etc
Batch conversion: e.g. babel *.mol -osmi -m
converts each input file to a .smi file

For conversions of molecules

Additional options :

-d Delete hydrogens (make implicit)
-h Add hydrogens (make explicit)
-p Add Hydrogens appropriate for pH model
-b Convert dative bonds e.g.[N+]([O-])=O to N(=O)=O
-c Center Coordinates
-C Combine mols in first file with others having same name
--filter <filterstring> Filter: convert only when tests are true:
--add <list> Add properties from descriptors:
--delete <list> Delete properties in list:
--append <list> Appends properties or descriptors in list to title:
-s"smarts" Convert only molecules matching SMARTS:
-v"smarts" Convert only molecules NOT matching SMARTS:
--join Join all input molecules into a single output molecule
--separate Output disconnected fragments separately
--property <attrib> <value> add or replace a property (SDF)
--title <title> Add or replace molecule title
--addtotitle <text> Append to title
--addformula Append formula to title
--AddPolarH Adds hydrogen to polar atoms only
--center Centers coordinates around (0,0,0)
--gen3D Generate 3D coordinates
--nodative Replace [N+]([O-])=O by N(=O)=O

Interface to OBAPI internals
API options, e.g. ---errorlevel 2
errorlevel # min warning level displayed

The following file formats are recognized:

acr -- ACR format [Read-only]
adf -- ADF cartesian input format [Write-only]
adfout -- ADF output format [Read-only]
alc -- Alchemy format
arc -- Accelrys/MSI Biosym/Insight II CAR format [Read-only]
bgf -- MSI BGF format
box -- Dock 3.5 Box format
bs -- Ball and Stick format
c3d1 -- Chem3D Cartesian 1 format
c3d2 -- Chem3D Cartesian 2 format
cac -- CAChe MolStruct format [Write-only]
caccrt -- Cacao Cartesian format
cache -- CAChe MolStruct format [Write-only]
cacint -- Cacao Internal format [Write-only]
can -- Canonical SMILES format.
car -- Accelrys/MSI Biosym/Insight II CAR format [Read-only]
ccc -- CCC format [Read-only]
cdx -- ChemDraw binary format [Read-only]
cdxml -- ChemDraw CDXML format
cht -- Chemtool format [Write-only]
cif -- Crystallographic Information File
ck -- ChemKin format
cml -- Chemical Markup Language
cmlr -- CML Reaction format
com -- Gaussian 98/03 Input [Write-only]
copy -- Copies raw text [Write-only]
crk2d -- Chemical Resource Kit diagram(2D)
crk3d -- Chemical Resource Kit 3D format
csr -- Accelrys/MSI Quanta CSR format [Write-only]
cssr -- CSD CSSR format [Write-only]
ct -- ChemDraw Connection Table format
cub -- OpenDX cube format for APBS
cube -- OpenDX cube format for APBS
dmol -- DMol3 coordinates format
dx -- OpenDX cube format for APBS
ent -- Protein Data Bank format
fa -- FASTA format [Write-only]
fasta -- FASTA format [Write-only]
fch -- Gaussian formatted checkpoint file format [Read-only]
fchk -- Gaussian formatted checkpoint file format [Read-only]
fck -- Gaussian formatted checkpoint file format [Read-only]
feat -- Feature format
fh -- Fenske-Hall Z-Matrix format [Write-only]
fix -- SMILES FIX format [Write-only]
fpt -- Fingerprint format [Write-only]
fract -- Free Form Fractional format
fs -- FastSearching
fsa -- FASTA format [Write-only]
g03 -- Gaussian98/03 Output [Read-only]
g92 -- Gaussian98/03 Output [Read-only]
g94 -- Gaussian98/03 Output [Read-only]
g98 -- Gaussian98/03 Output [Read-only]
gal -- Gaussian98/03 Output [Read-only]
gam -- GAMESS Output [Read-only]
gamin -- GAMESS Input
gamout -- GAMESS Output [Read-only]
gau -- Gaussian 98/03 Input [Write-only]
gjc -- Gaussian 98/03 Input [Write-only]
gjf -- Gaussian 98/03 Input [Write-only]
gpr -- Ghemical format
gr96 -- GROMOS96 format [Write-only]
gukin -- GAMESS-UK Input
gukout -- GAMESS-UK Output
gzmat -- Gaussian Z-Matrix Input
hin -- HyperChem HIN format
inchi -- InChI format
inp -- GAMESS Input
ins -- ShelX format [Read-only]
jin -- Jaguar input format [Write-only]
jout -- Jaguar output format [Read-only]
k -- Compare molecules using InChI [Write-only]
mcdl -- MCDL format
mcif -- Macromolecular Crystallographic Information
mdl -- MDL MOL format
ml2 -- Sybyl Mol2 format
mmcif -- Macromolecular Crystallographic Information
mmd -- MacroModel format
mmod -- MacroModel format
mol -- MDL MOL format
mol2 -- Sybyl Mol2 format
molden -- Molden input format [Read-only]
molreport -- Open Babel molecule report [Write-only]
moo -- MOPAC Output format [Read-only]
mop -- MOPAC Cartesian format
mopcrt -- MOPAC Cartesian format
mopin -- MOPAC Internal
mopout -- MOPAC Output format [Read-only]
mpc -- MOPAC Cartesian format
mpd -- Sybyl descriptor format [Write-only]
mpqc -- MPQC output format [Read-only]
mpqcin -- MPQC simplified input format [Write-only]
msi -- Accelrys/MSI Cerius II MSI format [Read-only]
msms -- M.F. Sanner's MSMS input format [Write-only]
nw -- NWChem input format [Write-only]
nwo -- NWChem output format [Read-only]
outmol -- DMol3 coordinates format
pc -- PubChem format [Read-only]
pcm -- PCModel Format
pdb -- Protein Data Bank format
png -- PNG files with embedded data
pov -- POV-Ray input format [Write-only]
pqr -- PQR format
pqs -- Parallel Quantum Solutions format
prep -- Amber Prep format [Read-only]
qcin -- Q-Chem input format [Write-only]
qcout -- Q-Chem output format [Read-only]
report -- Open Babel report format [Write-only]
res -- ShelX format [Read-only]
rsmi -- Reaction SMILES format
rxn -- MDL RXN format
sd -- MDL MOL format
sdf -- MDL MOL format
smi -- SMILES format
smiles -- SMILES format
sy2 -- Sybyl Mol2 format
t41 -- ADF TAPE41 format [Read-only]
tdd -- Thermo format
test -- Test format [Write-only]
therm -- Thermo format
tmol -- TurboMole Coordinate format
txt -- Title format
txyz -- Tinker MM2 format [Write-only]
unixyz -- UniChem XYZ format
vmol -- ViewMol format
xed -- XED format [Write-only]
xml -- General XML format [Read-only]
xtc -- XTC format [Read-only]
xyz -- XYZ cartesian coordinates format
yob -- YASARA.org YOB format
zin -- ZINDO input format [Write-only]

cml Chemical Markup Language
XML format. This implementation uses libxml2.
Write options for CML: -x[flags] (e.g. -x1ac)
1 output CML1 (rather than CML2)
a output array format for atoms and bonds
A write aromatic bonds as such, not Kekule form
h use hydrogenCount for all hydrogens
m output metadata
x omit XML and namespace declarations
c continuous output: no formatting
p output properties
N add namespace prefix to elements

Input options, e.g. -a2

Thursday, March 5, 2009

Random Layer using javascript

Display random layer/div in javascript

<HTML>
<Head>
<Script Language="javascript">

//global var
var last_index=0;
box_len=5;

function ret_index()
{
var ran;
do{
ran=Math.floor(Math.random()*box_len);
if(ran==0)ran=box_len;
}while(ran==last_index);

last_index=ran;
return ran;
}

function show_one(){
vBox=ret_index();
for(var i=1;i<=box_len;i++){
if(vBox!=i){
obj=document.getElementById("box_0"+i);
obj.style.display="none";
}else{
obj=document.getElementById("box_0"+i);
obj.style.display="inline";
}
}
}

</Script>
<Body>
<a href="javascript:show_one();">show One</a>
<div id='box_01' style="position:absolute;left:120;width:100;height:100;border:1px solid red;text-align:center">
<br>Box1
</div>
<div id='box_02' style="position:absolute;left:240;width:100;height:100;border:1px solid red;text-align:center">
<br>Box2
</div>
<div id='box_03' style="position:absolute;left:360;width:100;height:100;border:1px solid red;text-align:center">
<br>Box3
</div>
<div id='box_04' style="position:absolute;left:480;width:100;height:100;border:1px solid red;text-align:center">
<br>Box4
</div>
<div id='box_05' style="position:absolute;left:600;width:100;height:100;border:1px solid red;text-align:center">
<br>Box5
</div>
</body>
</Html>

Dynamic ArrayCollection Using Flex

Creating Dynamic Array Collection Using Flex.

 var ob:Object;
var n:String = "Name";
var a:String = "Address";
var ar:ArrayCollection = "";

ob = new Object();

ob[n] = "Ar";
ob[a] = "xyz, UK";

ar = new ArrayCollection();
ar.addItem(ob);


ArrayCollection filterfunction

HTML Meta Tags

The Meta tags are not compulsory tags for HTML or web pages. Meta tags provide information of web page to the search engines. If you put Meta tags in your web page it should be more briefly, these meta tags is used by search engines to index your web pages into their server. If you put brief & more specific meta tags then search engines put your web pages into accurate indexes.

Basic Meta tags are Keywords & Description that content length should be less than & equal to near about 255 characters.

Keywords Meta tag is used to define keywords of web page.

<meta name="Keywords" content="HTML,PHP,ASP">


Description Meta tag is to used define description of web page.

<meta name="Description" content="IT Help Desk">


Revised Meta tag is used to define last update of web page

<meta name="revised" content="01/11/08" />


Refresh Meta tag used to update web page every 10 seconds.

<meta http-equiv="refresh" content="10" />

Microsoft SharePoint

Microsoft SharePoint is product of Microsoft. It's browser based document Management System. You can handle many task in SharePoint such as task list or Discussion pane, Web Parts, Meetings Alert etc. SharedPoint allow users to access SharePoint workspace using web Services.

Web Service for Administrative methods such as creating and deleting sites
http://server:5966/_vti_adm/Admin.asmx

Web Service for working with alerts
http://server/_vti_bin/Alerts.asmx

Web Service for retrieving schemas and data
http://server/_vti_bin/DspSts.asmx

Web Service for working with Document Workspaces
http://server/_vti_bin/DWS.asmx

Web Service for working with user interface forms
http://server/_vti_bin/Forms.asmx

Web Service for working with picture libraries
http://server/_vti_bin/Imaging.asmx

Web Service for working with lists.
http://server/_vti_bin/Lists.asmx

Web Service for working with Meeting Workspaces
http://server/_vti_bin/Meetings.asmx

Web Service for working with SharePoint Services security
http://server/_vti_bin/Permissions.asmx

Web Service for Windows SharePoint Portal Server
http://server/_vti_bin/SiteData.asmx

Web Service for Contains a single method to retrieve site templates
http://server/_vti_bin/Sites.asmx

Web Service for working with users and groups
http://server/_vti_bin/UserGroup.asmx

Web Service for working with file versions
http://server/_vti_bin/versions.asmx

Web Service for working with views of lists
http://server/_vti_bin/Views.asmx

Web Service for working with Web Parts
http://server/_vti_bin/WebPartPages.asmx

Web Service for working with sites and subsites
http://server/_vti_bin/Webs.asmx