Skip to main content

Posts

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

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

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].ToStrin

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

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 fil

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. -H

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

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